### Question:
JavaToolsClassLoader extends URLClassLoader { public static ClassLoader createIfNeeded() throws CodeGenFailedException { ClassLoader parent = Thread.currentThread().getContextClassLoader(); if(!needToolsJar(parent)) { return parent; } File toolsJar = findToolsJar(); try { URL urls[] = { toolsJar.toURI().toURL() }; return new JavaToolsClassLoader(urls, parent); } catch (MalformedURLException e) { throw new CodeGenFailedException( "MalformedURLException from the tools.jar location: " + toolsJar.getAbsolutePath(), e); } } JavaToolsClassLoader(URL[] urls, ClassLoader parent); static ClassLoader createIfNeeded(); static boolean needToolsJar(ClassLoader classloader); static File findToolsJar();  }### Answer:
@Test public void testCreate() throws CodeGenFailedException { ClassLoader cl = JavaToolsClassLoader.createIfNeeded(); Assert.assertNotNull("JavaToolsClassLoader should not be null", cl); assertClassPresent(cl, "com.sun.tools.javac.Main"); assertClassPresent(cl, "com.sun.tools.apt.Main"); assertClassPresent(cl, "com.sun.javadoc.Doclet"); assertClassPresent(cl, "com.sun.javadoc.Type"); }