AttributeKey extends AbstractConstant<AttributeKey<T>> { @SuppressWarnings("unchecked") public static <T> AttributeKey<T> newInstance(String name) { return (AttributeKey<T>) pool.newInstance(name); } private  AttributeKey(int id, String name); @SuppressWarnings("unchecked") static AttributeKey<T> valueOf(String name); static boolean exists(String name); @SuppressWarnings("unchecked") static AttributeKey<T> newInstance(String name); @SuppressWarnings("unchecked") static AttributeKey<T> valueOf(Class<?> firstNameComponent, String secondNameComponent);  }
@Test public void testNewInstance() { String name = "test2"; assertFalse(AttributeKey.exists(name)); AttributeKey<String> attr = AttributeKey.newInstance(name); assertTrue(AttributeKey.exists(name)); assertNotNull(attr); try { AttributeKey.<String>newInstance(name); fail(); } catch (IllegalArgumentException e) { } }