LogManagerProperties extends Properties { static boolean isReflectionClass(String name) throws Exception { String[] names; if ((names = REFLECT_NAMES) == null) { REFLECT_NAMES = names = reflectionClassNames(); } for (String rf : names) { if (name.equals(rf)) { return true; } } findClass(name); return false; } LogManagerProperties(final Properties parent, final String prefix); @Override @SuppressWarnings("CloneDoesntCallSuperClone") synchronized Object clone(); @Override synchronized String getProperty(final String key); @Override String getProperty(final String key, final String def); @Override Object get(final Object key); @Override synchronized Object put(final Object key, final Object value); @Override Object setProperty(String key, String value); @Override boolean containsKey(final Object key); @Override synchronized Object remove(final Object key); @Override Enumeration<?> propertyNames(); @Override boolean equals(final Object o); @Override int hashCode();  }
@Test public void testIsReflection() throws Exception { assertTrue(LogManagerProperties.isReflectionClass(Constructor.class.getName())); assertTrue(LogManagerProperties.isReflectionClass(Method.class.getName())); }
@Test(expected = NullPointerException.class) public void testIsReflectionNull() throws Exception { LogManagerProperties.isReflectionClass((String) null); }
@Test(expected = ClassNotFoundException.class) public void testIsReflectionInvaildName() throws Exception { LogManagerProperties.isReflectionClass("badClassName"); }