ResourceLocator { public static Iterable<URL> findNamedResources(String name) { URI nameUri = URI.create(name); if (!isClasspath(nameUri)) { throw new IllegalArgumentException( "unsupported or missing schema <" + nameUri.getScheme() + "> classpath: schema is supported."); } return urlClassPathResource(nameUri); } private  ResourceLocator(); static Iterable<URL> findNamedResources(String name); static URL findNamedResource(final String name);  }
@Test public void classPathExample() throws IOException { final Path firstModuleDir = createDirectoryWithAFile("first", "module.yaml"); final Path secondModuleDir = createDirectoryWithAFile("second", "module.yaml"); ClassLoader urlClassLoader = urlClassLoader(firstModuleDir, secondModuleDir); try (SetContextClassLoader ignored = new SetContextClassLoader(urlClassLoader)) { Iterable<URL> foundUrls = ResourceLocator.findNamedResources("classpath:module.yaml"); assertThat( foundUrls, contains( url(firstModuleDir.resolve("module.yaml")), url(secondModuleDir.resolve("module.yaml")))); } }