### Question:
ModuleListParser { static void doParse( PushbackInputStream inputStream, List<KernelModuleEntry> kernelModuleEntries, Position pos) throws IOException { for (; ; ) { var pint = peekInt(inputStream); if (pint == -1 || pint == 255) { return; } parseModuleList(inputStream, kernelModuleEntries, pos); inputStream.read(); trimWhitespace(inputStream, pos); pint = peekInt(inputStream); if (pint == -1 || pint == 255) { return; } } }  static List<KernelModuleEntry> read(FileSystem fs, String moduleList);  }### Answer:
@Test void ensureParsingCompleteLineWorksSansLibDirectoriesWorks() throws IOException { val test = s("1:io.sunshower:sunshower-whatever:1.0.0-SNAPSHOT"); val position = new ModuleListParser.Position(); val items = new ArrayList<KernelModuleEntry>(); ModuleListParser.doParse(test, items, position); assertEquals(items.size(), 1, "must have one entry in it"); val result = items.get(0); assertEquals(result.getOrder(), 1); assertEquals(result.getGroup(), "io.sunshower"); assertEquals(result.getName(), "sunshower-whatever"); assertEquals(result.getVersion(), "1.0.0-SNAPSHOT"); assertTrue(result.getLibraryFiles().isEmpty()); }
@Test void ensureWhateverWorks() throws IOException { try (val fs = new PushbackInputStream(ClassLoader.getSystemResourceAsStream("modules/modules.list"))) { val list = new ArrayList<KernelModuleEntry>(); val pos = new ModuleListParser.Position(); ModuleListParser.doParse(fs, list, pos); assertEquals(list.size(), 5); } }
@Test void ensureParsingCompleteLineWithLibraryFilesWorks() throws IOException { val test = s("1:io.sunshower:sunshower-whatever:1.0.0-SNAPSHOT[lib/dapper,frapper,dapper]"); val pos = new ModuleListParser.Position(); val items = new ArrayList<KernelModuleEntry>(); ModuleListParser.doParse(test, items, pos); val result = items.get(0); assertEquals( new HashSet<>(result.getLibraryFiles()), Set.of("lib/dapper", "frapper", "dapper")); }