### Question:
BlockingClassLoader extends URLClassLoader { @Override protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { if (!m_shared.matches(name, false)) { if (m_respectGrandparents) { try { return Class.forName(name, resolve, getParent().getParent()); } catch (ClassNotFoundException e) { } } if (m_blocked.matches(name, false)) { throw new ClassNotFoundException(); } if (m_isolated.matches(name, false)) { synchronized (this) { Class<?> c = findLoadedClass(name); if (c == null) { c = findClass(name); } if (resolve) { resolveClass(c); } return c; } } } return super.loadClass(name, resolve); } BlockingClassLoader(URLClassLoader parent,
                             List<URL> additionalClassPath,
                             Set<String> blocked,
                             Set<String> isolated,
                             Set<String> shared,
                             boolean respectGrandparents);  BlockingClassLoader(List<URL> additionalClassPath,
                             Set<String> blocked,
                             Set<String> isolated,
                             Set<String> shared,
                             boolean respectGrandparents);  BlockingClassLoader(Set<String> blocked,
                             Set<String> isolated,
                             Set<String> shared,
                             boolean respectGrandparents); @Override URL getResource(String name); @Override Enumeration<URL> getResources(String name);  }### Answer:
@Test public void testWithLoadableClass() throws Exception { final BlockingClassLoader cl = new BlockingClassLoader(Collections.<String>emptySet(), singleton("net.grinder.*"), Collections.<String>emptySet(), false); final String name = "net.grinder.util.AnIsolatedClass"; final Class<?> c = cl.loadClass(name, true); assertSame(c, Class.forName(name, false, cl)); }