ClassUtil { public static <T> Class<? extends T> getClass(String className, Class<T> baseClass) throws ClassNotFoundException { ClassLoader classLoader = Thread.currentThread() .getContextClassLoader(); if (classLoader == null) { classLoader = ClassUtil.class.getClassLoader(); } return Class.forName(className, true, classLoader) .asSubclass(baseClass); } private  ClassUtil(); static Class<? extends T> getClass(String className,
            Class<T> baseClass); static Object instantiate(String className); static Object instantiate(String className, boolean returnNull); static void collectBeanInfo(Class<?> clazz,
            Map<String, PropertyDescriptor> name2descriptor);  }
@Test public void testGetClass() throws ClassNotFoundException { assertEquals(TestInterface.class, ClassUtil.getClass( TestInterface.class.getName(), Object.class)); }
@Test(expected = ClassNotFoundException.class) public void testGetClassException() throws ClassNotFoundException { ClassUtil.getClass("this.class.does.not.Exist", Object.class); }