### Question:
ReflectUtil { public static <T> T newInstance(Class<T> expectedClass, String className) { Class<?> actualClass = ClassUtil.forName(className); Object obj = ClassUtil.newInstance(actualClass); if (expectedClass.isInstance(obj)) { return expectedClass.cast(obj); } throw new ClassUnmatchRuntimeException(expectedClass, actualClass); } protected  ReflectUtil(); static T newInstance(Class<T> expectedClass, String className);  }### Answer:
@Test public void testNewInstance() throws Exception { String baseName = getClass().getName(); Aaa aaa = ReflectUtil.newInstance(Aaa.class, baseName + "$Bbb"); assertNotNull(aaa); }
@Test public void testNewInstance_classUnmatch() throws Exception { String baseName = getClass().getName(); try { ReflectUtil.newInstance(Aaa.class, baseName + "$Ccc"); fail(); } catch (ClassUnmatchRuntimeException expected) { } }