### Question:
ConfigurableClassLoader extends URLClassLoader { @Override public InputStream getResourceAsStream(final String name) { return ofNullable(doGetResourceAsStream(name)) .orElseGet(() -> ofNullable(resources.get(name)) .filter(s -> s.size() > 0) .map(s -> s.iterator().next().resource) .map(ByteArrayInputStream::new) .orElse(null)); } ConfigurableClassLoader(final String id, final URL[] urls, final ClassLoader parent,
            final Predicate<String> parentFilter, final Predicate<String> childFirstFilter,
            final String[] nestedDependencies, final String[] jvmPrefixes); private  ConfigurableClassLoader(final String id, final URL[] urls, final ClassLoader parent,
            final Predicate<String> parentFilter, final Predicate<String> childFirstFilter,
            final Map<String, Collection<Resource>> resources, final String[] jvmPrefixes); Class<?> registerBytecode(final String name, final byte[] bytes); String[] getJvmMarkers(); void registerTransformer(final ClassFileTransformer transformer); synchronized URLClassLoader createTemporaryCopy(); @Override synchronized void close(); @Override Class<?> loadClass(final String name, final boolean resolve); @Override URL findResource(final String name); @Override Enumeration<URL> getResources(final String name); @Override URL getResource(final String name); @Override InputStream getResourceAsStream(final String name); @Override Enumeration<URL> findResources(final String name); List<InputStream> findContainedResources(final String name); static final String NESTED_MAVEN_REPOSITORY; }### Answer:
@Test void getResourceAsStreamChildFirst(@TempDir final File temporaryFolder) throws IOException { final File jar = new File(temporaryFolder, "getResourceAsStreamChildFirst.jar"); temporaryFolder.mkdirs(); try (final JarOutputStream outputStream = new JarOutputStream(new FileOutputStream(jar))) { outputStream.putNextEntry(new JarEntry("found.in.child.and.parent")); outputStream.write("child".getBytes(StandardCharsets.UTF_8)); outputStream.closeEntry(); } try (final URLClassLoader parent = new URLClassLoader(new URL[0], Thread.currentThread().getContextClassLoader()); final ConfigurableClassLoader loader = new ConfigurableClassLoader("", new URL[] { jar.toURI().toURL() }, parent, name -> true, name -> true, new String[0], new String[0])) { try (final BufferedReader reader = new BufferedReader( new InputStreamReader(loader.getResourceAsStream("found.in.child.and.parent")))) { assertEquals("child", reader.lines().collect(joining()).trim()); } } }