ReflectionUtil { public static <T> T newInstance(Class<T> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { log.error("Error instantiating " + clazz.getName(), e); throw new RuntimeException(e); } }  static T newInstance(Class<T> clazz);  }
@Test public void testNewInstance() { val result = ReflectionUtil.newInstance(OutlierDetectorResult.class); assertEquals(OutlierDetectorResult.class, result.getClass()); }
@Test(expected = RuntimeException.class) public void testNewInstance_instantiationException() { ReflectionUtil.newInstance(AnomalyThresholds.class); }