ReflectionHelper { public static Object instanceFromClassName(String className) { Class classObject; try { classObject = Class.forName(className); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("Unable to load class " + className, e); } try { return classObject.getConstructor().newInstance(); } catch (Exception e) { throw new IllegalArgumentException("Unable to instantiate class " + className, e); } } private  ReflectionHelper(); static Class<?> getConcreteTypeOfGenericInterfaceImplementation(
            Object instanceToExamine,
            Class<?> implementedInterfaceClass,
            int parameterIndex); static Class<?> getConcreteTypeOfGenericClassExtension(
            Class<?> classToExamine,
            int parameterIndex); static Object instanceFromClassName(String className);  }
@Test void newInstance() { assertTrue(instanceFromClassName("java.util.ArrayList") instanceof ArrayList); assertThrows(Throwable.class, () -> instanceFromClassName("java.lang.Double")); assertThrows(Throwable.class, () -> instanceFromClassName("java.lang.xxx")); }