diff options
Diffstat (limited to 'test/core/src/lombok/TestViaDelombok.java')
-rw-r--r-- | test/core/src/lombok/TestViaDelombok.java | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/test/core/src/lombok/TestViaDelombok.java b/test/core/src/lombok/TestViaDelombok.java index a3e97098..63a8e1f8 100644 --- a/test/core/src/lombok/TestViaDelombok.java +++ b/test/core/src/lombok/TestViaDelombok.java @@ -35,10 +35,11 @@ import lombok.delombok.Delombok; public class TestViaDelombok { private static Delombok delombok = new Delombok(); + private static volatile boolean printErrors = false; private static final String LINE_SEPARATOR = System.getProperty("line.separator"); - public static void runComparison(File beforeDir, File afterDir) throws IOException { + public static void runComparison(File beforeDir, File afterDir) throws Throwable { File[] listFiles = beforeDir.listFiles(); for (File file : listFiles) { @@ -46,7 +47,7 @@ public class TestViaDelombok { } } - public static void compareFile(File afterDir, File file) throws IOException { + public static void compareFile(File afterDir, File file) throws Throwable { delombok.setVerbose(false); delombok.setForceProcess(true); delombok.setCharset("UTF-8"); @@ -55,7 +56,30 @@ public class TestViaDelombok { compare(file.getName(), readAfter(afterDir, file), writer.toString()); } - private static void compare(String name, String expectedFile, String actualFile) { + public static void printErrors(boolean print) { + printErrors = print; + } + + private static void compare(String name, String expectedFile, String actualFile) throws Throwable { + try { + compareContent(name, expectedFile, actualFile); + } + catch (Throwable e) { + if (printErrors) { + System.out.println("***** " + name + " *****"); + System.out.println(e.getMessage()); + System.out.println("**** Expected ******"); + System.out.println(expectedFile); + System.out.println("**** Actual ******"); + System.out.println(actualFile); + System.out.println("*******************"); + } + throw e; + } + } + + private static void compareContent(String name, String expectedFile, + String actualFile) { String[] expectedLines = expectedFile.split("(\\r?\\n)"); String[] actualLines = actualFile.split("(\\r?\\n)"); if (actualLines[0].startsWith("// Generated by delombok at ")) { |