### Question:
ClassUtils { public static boolean classExists(String implClassName) { try { forName(implClassName); return true; } catch (ClassNotFoundException ignored) { return false; } } private  ClassUtils(); static Class<T> loadClass(String className); static Class<? extends T> loadClass(String className, Class<T> superClass); static boolean classExists(String implClassName); static T loadInstanceOf(Class<T> clazz); static T loadInstanceOf(String implClassName, Class<T> superClass); static T loadInstanceOf(String implClassName,
                                     Class<T> superClass,
                                     Class<?>[] constructorTypes,
                                     Object[] constructorArgs);  }### Answer:
@Test public void testExists() { assertTrue(ClassUtils.classExists("java.lang.String")); assertTrue(ClassUtils.classExists("com.cloudera.oryx.common.lang.ClassUtils")); assertFalse(ClassUtils.classExists("java.Foo")); }
@Test public void testNoContextCL() { Thread current = Thread.currentThread(); ClassLoader savedCL = current.getContextClassLoader(); current.setContextClassLoader(null); try { assertTrue(ClassUtils.classExists(ClassUtilsTest.class.getName())); } finally { current.setContextClassLoader(savedCL); } }