### Question:
ReflectionUtil { public static <T> T newInstance(Class<T> theType) { Validate.notNull(theType, "theType must not be null"); try { return theType.getConstructor().newInstance(); } catch (Exception e) { throw new ConfigurationException("Failed to instantiate " + theType.getName(), e); } }  static List<Method> getDeclaredMethods(Class<?> theClazz); static String describeMethodInSortFriendlyWay(Method theMethod); static Class<?> getGenericCollectionTypeOfField(Field next); static Class<?> getGenericCollectionTypeOfFieldWithSecondOrderForList(Field next); static Class<?> getGenericCollectionTypeOfMethodParameter(Method theMethod, int theParamIndex); static Class<?> getGenericCollectionTypeOfMethodReturnType(Method theMethod); static boolean isInstantiable(Class<?> theType); static T newInstance(Class<T> theType); static T newInstance(Class<T> theType, Class<?> theArgumentType, Object theArgument); static Object newInstanceOfFhirServerType(String theType); static T newInstanceOrReturnNull(String theClassName, Class<T> theType); @SuppressWarnings("unchecked") static T newInstanceOrReturnNull(String theClassName, Class<T> theType, Class<?>[] theArgTypes, Object[] theArgs); static boolean typeExists(String theName); static final Object[] EMPTY_OBJECT_ARRAY; static final Class<?>[] EMPTY_CLASS_ARRAY; }### Answer:
@Test public void testNewInstance() { assertEquals(ArrayList.class, ReflectionUtil.newInstance(ArrayList.class).getClass()); }
@Test public void testNewInstanceFail() { try { ReflectionUtil.newInstance(List.class); fail(); } catch (ConfigurationException e) { assertEquals("Failed to instantiate java.util.List", e.getMessage()); } }