IsolatedClassloader extends URLClassLoader { @Override public Enumeration<URL> getResources(String name) throws IOException { return findResources(name); } IsolatedClassloader(ClassLoader parent, ClassloadRules rules); @Override URL getResource(String name); @Override Enumeration<URL> getResources(String name);  }
@Test public void dont_get_resources_from_parent() throws IOException { Enumeration<URL> resource2 = classLoader.getParent().getResources("fake.jar"); assertThat(resource2.hasMoreElements()).isTrue(); Enumeration<URL> resource = classLoader.getResources("fake.jar"); assertThat(resource.hasMoreElements()).isFalse(); }