Reflection { public static boolean isClassAvailable(String className) { return forName(className) != null; } private  Reflection(); static boolean isClassAvailable(String className); static Class<?> forName(String className); static boolean isDefault(Method method); static Object invokeDefaultMethod(Object proxy, Method method, Object[] args);  }
@Test public void testAvailableWithNonExistentClass() { boolean available = Reflection.isClassAvailable("foo.bar.baz.FooBar"); assertFalse(available); }
@Test public void testAvailableWithExistentClass(){ boolean available = Reflection.isClassAvailable("java.lang.String"); assertTrue(available); }