### Question:
IsolatedClassRealm extends URLClassLoader { @Override public URL getResource( String name ) { if ( isImported( name ) ) { URL resource = parent.getResource( name ); if ( resource != null ) { return resource; } } URL resource = super.getResource( name ); if ( resource != null ) { return resource; } resource = super.findResource( name ); if ( resource != null ) { return resource; } return null; } IsolatedClassRealm( ClassLoader parent ); void addJar( Path jar ); void addJarDirectory( Path dir ); void importPackage( String packageName ); void importAllPackages( String packageName ); @Override Class<?> loadClass( String name ); @Override URL getResource( String name ); @Override Enumeration<URL> getResources( String name );  }### Answer:
@Test public void testGetResource() throws Exception { try (IsolatedClassRealm realm = new IsolatedClassRealm( IsolatedClassRealmTest.class.getClassLoader() )) { realm.addJar( jarPath ); try (InputStream resourceStream = realm.getResourceAsStream( "secret-file" )) { assertNotNull( resourceStream ); int read = resourceStream.read(); assertEquals( '#', read ); } } }