@@ -0,0 +1,1885 @@
+package test.base;%0A%0Aimport static org.junit.jupiter.api.Assertions.assertEquals;%0A%0Aimport java.io.OutputStream;%0Aimport java.io.PrintWriter;%0Aimport java.lang.module.ModuleDescriptor;%0Aimport java.lang.module.ModuleFinder;%0Aimport java.lang.module.ModuleReference;%0Aimport java.nio.file.Files;%0Aimport java.nio.file.Path;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.Set;%0Aimport java.util.TreeSet;%0Aimport java.util.spi.ToolProvider;%0Aimport java.util.stream.Collectors;%0Aimport org.junit.jupiter.api.Test;%0Aimport org.junit.jupiter.api.io.TempDir;%0A%0Aclass ModuleFinderTests %7B%0A%0A  @Test%0A  void findsModuleOnlyIfItsArchiveExistedOnCreationTime(@TempDir Path temp) throws Exception %7B%0A    var emptyFinder = ModuleFinder.of(temp);%0A    assertEquals(Set.of(), findAllModuleNames(emptyFinder));%0A    buildModule(temp, %22foo%22);%0A    assertEquals(Set.of(), findAllModuleNames(emptyFinder));%0A    assertEquals(Set.of(%22foo%22), findAllModuleNames(ModuleFinder.of(temp))); // %3C- new finder%0A  %7D%0A%0A  static void buildModule(Path temp, String name, String... directives) throws Exception %7B%0A    var javac = ToolProvider.findFirst(%22javac%22).orElseThrow();%0A    var jar = ToolProvider.findFirst(%22jar%22).orElseThrow();%0A    var z = new PrintWriter(OutputStream.nullOutputStream());%0A    var lines = new ArrayList%3CString%3E();%0A    lines.add(%22module %22 + name + %22 %7B%22);%0A    lines.addAll(List.of(directives));%0A    lines.add(%22%7D%22);%0A    var file = Files.write(temp.resolve(%22module-info.java%22), lines);%0A    javac.run(z, z, file.toString());%0A    var foo = temp.resolve(name + %22.jar%22).toString();%0A    jar.run(z, z, %22--create%22, %22--file%22, foo, temp + %22/module-info.class%22);%0A  %7D%0A%0A  static Set%3CString%3E findAllModuleNames(ModuleFinder finder) %7B%0A    return finder.findAll().stream()%0A        .map(ModuleReference::descriptor)%0A        .map(ModuleDescriptor::name)%0A        .collect(Collectors.toCollection(TreeSet::new));%0A  %7D%0A%7D%0A

Check module finder contract