### Question:
ReflectionUtil { public static <T> T newInstanceOrReturnNull(String theClassName, Class<T> theType) { return newInstanceOrReturnNull(theClassName, theType, EMPTY_CLASS_ARRAY, EMPTY_OBJECT_ARRAY); }  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 testNewInstanceOrReturnNullString() { assertEquals(ArrayList.class, ReflectionUtil.newInstanceOrReturnNull(ArrayList.class.getName(), List.class).getClass()); }
@Test public void testNewInstanceOrReturnNullWrong1() { assertEquals(null, ReflectionUtil.newInstanceOrReturnNull("foo.Foo", List.class)); }
@Test public void testNewInstanceOrReturnNullWrong2() { try { ReflectionUtil.newInstanceOrReturnNull("java.lang.String", List.class); fail(); } catch (ConfigurationException e) { assertEquals("java.lang.String is not assignable to interface java.util.List", e.getMessage()); } }