JavaParser { public static void main(String[] argv) { for (int i = 0; i < argv.length; i++) { try { System.out.println("Parsing [" + argv[i] + "]"); Scanner s = new Scanner(new UnicodeEscapes(new FileReader(argv[i]))); parser p = new parser(s); p.parse(); System.out.println("No errors."); } catch (Exception e) { e.printStackTrace(System.err); System.exit(1); } } }  static void main(String[] argv);  }
@Test public void parseTest() throws Exception { File inputFile = openFile("src/main/java/TestLexer.java"); assertThat(inputFile.isFile()).isTrue(); String[] argv = new String[] {inputFile.getPath()}; JavaParser.main(argv); }
@Test public void lexTest() throws Exception { File inputFile = openFile("src/main/java/TestLexer.java"); assertThat(inputFile.isFile()).isTrue(); String[] argv = new String[] {inputFile.getPath()}; TestLexer.main(argv); File expected = openFile("src/test/data/lexer-output.good"); assertThat(expected.isFile()).isTrue(); BufferedReader actualContent = readOutputStream(); BufferedReader expectedContent = new BufferedReader(new FileReader(expected)); for (int lineNumber = 1; lineNumber != -1; lineNumber++) { String expectedLine = expectedContent.readLine(); String actualLine = actualContent.readLine(); assertWithMessage("Line " + lineNumber).that(actualLine).isEqualTo(expectedLine); if (expectedLine == null) lineNumber = -2; } }