### Question:
ClassUtil { public static Class<?> findClass( final List< String > packages, final List< String > externaljars, final String className ) throws ClassNotFoundException { if (!classLoaderSetup) { loader = setupClassLoader(externaljars); } try { return loader.loadClass( className ); } catch( final ClassNotFoundException e ) { for( final String packageName : packages ) { try { return loader.loadClass( packageName + "." + className ); } catch( final ClassNotFoundException ex ) { } } } throw new ClassNotFoundException( "Class '" + className + "' not found in search path!" ); } private  ClassUtil(); static Class<?> findClass( final List< String > packages,  final List< String > externaljars, final String className ); static Class< ? > findClass( final String packageName, final String className ); static List< String > classpathEntriesUnder( final String rootPackage ); @SuppressWarnings("unchecked") static T getMappedObject( final String requestedClass ); @SuppressWarnings( "unchecked" ) static T getMappedObject( final String requestedClass, final Object... initargs ); static Class< ? > getMappedClass( final String requestedClass ); static boolean assignable( final String srcClassName, final String parentClassName ); static boolean exists( final String className ); static Map< String, String > getExtraClassMappings(); static final String MAPPINGS; static final String MAPPINGS_EXTRA; }### Answer:
@Test public void testFindClass() throws Exception { final Class< ? > foo = ClassUtil.findClass( "java.util", "List" ); Assertions.assertEquals( foo.getName(), "java.util.List" ); }
@Test public void testFindClassNoClass() { Assertions.assertThrows( ClassNotFoundException.class, () -> ClassUtil.findClass( "org.apache.wiki", "MubbleBubble" ) ); }