### Question:
Generator { public static void main(String[] args) throws IOException { Path path = Paths.get(args[0]); if (path.toFile().isDirectory()) { try (Stream<Path> files = Files.walk(path)) { files.filter(p -> p.toString().endsWith(".java")) .forEach(Generator::createUastFile); } } else { Generator.createUastFile(path); } } Generator(String source); static void main(String[] args); static Set<String> allKindNames(); UastNode uast(); String json();  }### Answer:
@Test void test_generator_main() throws Exception { Generator.main(new String[] {"src/test/files/source.java"}); Path generatedFile = Paths.get("src/test/files/source.java.uast.json"); String generatedUast = new String(Files.readAllBytes(generatedFile), StandardCharsets.UTF_8); String expectedUast = new String(Files.readAllBytes(Paths.get("src/test/files/reference.java.uast.json")), StandardCharsets.UTF_8).trim(); assertEquals(expectedUast, generatedUast); Files.deleteIfExists(generatedFile); }
@Test void test_generator_main_with_directory() throws Exception { Generator.main(new String[] {"src/test/files"}); Path generatedFile = Paths.get("src/test/files/source.java.uast.json"); String generatedUast = new String(Files.readAllBytes(generatedFile), StandardCharsets.UTF_8); String expectedUast = new String(Files.readAllBytes(Paths.get("src/test/files/reference.java.uast.json")), StandardCharsets.UTF_8).trim(); assertEquals(expectedUast, generatedUast); Files.deleteIfExists(generatedFile); }