@Test public void testParseFile() throws Exception { final String actual = AstTreeStringPrinter.printFileAst( new File(getPath("InputAstTreeStringPrinterComments.java")), false); final String expected = new String( Files.readAllBytes(Paths.get(getPath("expectedInputAstTreeStringPrinter.txt"))), StandardCharsets.UTF_8); Assert.assertEquals(expected, actual); }
@Test public void testParseFileWithJavadoc2() throws Exception { final String actual = AstTreeStringPrinter.printJavaAndJavadocTree( new File(getPath("InputAstTreeStringPrinterJavaAndJavadoc.java"))) .replaceAll("\\\\r\\\\n", "\\\\n"); final String expected = new String( Files.readAllBytes( Paths.get(getPath("expectedInputAstTreeStringPrinterJavaAndJavadoc.txt"))), StandardCharsets.UTF_8) .replaceAll("\\\\r\\\\n", "\\\\n"); Assert.assertEquals(expected, actual); }
@Test(expected = CheckstyleException.class) public void testParseFileThrowable() throws Exception { AstTreeStringPrinter.printFileAst( new File(getNonCompilablePath("InputAstTreeStringPrinter.java")), false); }