### Question:
PDIClassLoader extends URLClassLoader { @Override protected synchronized Class<?> loadClass( String name, boolean resolve ) throws ClassNotFoundException { try { return super.loadClass( name, resolve ); } catch ( NoClassDefFoundError e ) { return super.findClass( name ); } } PDIClassLoader( URL[] url, ClassLoader parent );  PDIClassLoader( ClassLoader parent );   }### Answer:
@Test public void testLoadClass() throws Exception { final String classToLoad = "dummy.Class"; final AtomicBoolean loadClassCalled = new AtomicBoolean(); ClassLoader parent = new ClassLoader() { @Override protected Class<?> loadClass( String name, boolean resolve ) throws ClassNotFoundException { if ( name.equals( classToLoad ) && !resolve ) { loadClassCalled.set( true ); } throw new NoClassDefFoundError(); } }; PDIClassLoader cl = new PDIClassLoader( parent ); try { cl.loadClass( classToLoad, true ); fail( "This class doesn't exist" ); } catch ( ClassNotFoundException cnfe ) { assertTrue( loadClassCalled.get() ); } }