### Question:
ClassUtils { @SuppressWarnings("deprecation") public static <T> T newInstance(Class<T> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ObjenesisException(e); } } private  ClassUtils(); static String classNameToInternalClassName(String className); static String classNameToResource(String className); @SuppressWarnings("unchecked") static Class<T> getExistingClass(ClassLoader classLoader, String className); @SuppressWarnings("deprecation") static T newInstance(Class<T> clazz);  }### Answer:
@Test public void testNewInstance_noArgsConstructorPresent() { ArrayList<?> i = ClassUtils.newInstance(ArrayList.class); assertTrue(i.isEmpty()); }
@Test public void testNewInstance_noArgsConstructorAbsent() { try { ClassUtils.newInstance(Integer.class); fail("No arg constructor. It should fail"); } catch(ObjenesisException e) { assertEquals(InstantiationException.class, e.getCause().getClass()); } }