aboutsummaryrefslogtreecommitdiff
path: root/test/core/src/lombok/TestViaDelombok.java
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/src/lombok/TestViaDelombok.java')
-rw-r--r--test/core/src/lombok/TestViaDelombok.java28
1 files changed, 15 insertions, 13 deletions
diff --git a/test/core/src/lombok/TestViaDelombok.java b/test/core/src/lombok/TestViaDelombok.java
index f9ea95f2..a3e97098 100644
--- a/test/core/src/lombok/TestViaDelombok.java
+++ b/test/core/src/lombok/TestViaDelombok.java
@@ -21,7 +21,7 @@
*/
package lombok;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
import java.io.BufferedReader;
import java.io.File;
@@ -42,14 +42,18 @@ public class TestViaDelombok {
File[] listFiles = beforeDir.listFiles();
for (File file : listFiles) {
- delombok.setVerbose(false);
- delombok.setForceProcess(true);
- delombok.setCharset("UTF-8");
- StringWriter writer = new StringWriter();
- delombok.delombok(file.getAbsolutePath(), writer);
- compare(file.getName(), readAfter(afterDir, file), writer.toString());
+ compareFile(afterDir, file);
}
}
+
+ public static void compareFile(File afterDir, File file) throws IOException {
+ delombok.setVerbose(false);
+ delombok.setForceProcess(true);
+ delombok.setCharset("UTF-8");
+ StringWriter writer = new StringWriter();
+ delombok.delombok(file.getAbsolutePath(), writer);
+ compare(file.getName(), readAfter(afterDir, file), writer.toString());
+ }
private static void compare(String name, String expectedFile, String actualFile) {
String[] expectedLines = expectedFile.split("(\\r?\\n)");
@@ -63,15 +67,13 @@ public class TestViaDelombok {
for (int i = 0; i < size; i++) {
String expected = expectedLines[i];
String actual = actualLines[i];
- if (!expected.equals(actual)) {
- fail(String.format("Difference in line %s(%d):\nExpected `%s`\nGot `%s`\n", name, i, expected, actual));
- }
+ assertEquals(String.format("Difference in %s on line %d", name, i + 1), expected, actual);
}
if (expectedLines.length > actualLines.length) {
- fail(String.format("Missing line %s(%d): %s\n", name, size, expectedLines[size]));
+ fail(String.format("Missing line %d in generated %s: %s", size + 1, name, expectedLines[size]));
}
if (expectedLines.length < actualLines.length) {
- fail(String.format("Extra line %s(%d): %s\n", name, size, actualLines[size]));
+ fail(String.format("Extra line %d in generated %s: %s", size + 1, name, actualLines[size]));
}
}
@@ -94,4 +96,4 @@ public class TestViaDelombok {
}
return out.toArray(new String[0]);
}
-}
+} \ No newline at end of file