aboutsummaryrefslogtreecommitdiff
path: root/test/core/src
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2013-07-16 00:51:31 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2013-07-16 00:51:31 +0200
commit7af9add9996f2efab6cccc50c5503b3457534930 (patch)
treebd224bd341da31e1b5aba5e718f43b6fd1227e8d /test/core/src
parentec0cc4348cf71d872b796d0733fb64fc576ef5df (diff)
downloadlombok-7af9add9996f2efab6cccc50c5503b3457534930.tar.gz
lombok-7af9add9996f2efab6cccc50c5503b3457534930.tar.bz2
lombok-7af9add9996f2efab6cccc50c5503b3457534930.zip
* Fixed issues with @FieldDefaults and @Value (you can NOT override
@Value's final-by-default and private-by-default with it; now appropriate warnings are emitted) * Builder now errors out on presence of most lombok annotations on an explicit builder class. * Builder now takes @FieldDefaults/@Value into account. * Builder on type now generates the constructor as package private instead of private to avoid synthetic accessor constructors. * added a bunch of test cases. * added a test case feature: If the expected file is omitted entirely but there are expected messages, the differences in the output itself are ignored. * streamlined checking for boolean-ness (removed some duplicate code) * added 'fluent' and 'chain' to @Builder.
Diffstat (limited to 'test/core/src')
-rw-r--r--test/core/src/lombok/AbstractRunTests.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/test/core/src/lombok/AbstractRunTests.java b/test/core/src/lombok/AbstractRunTests.java
index a80c7d8d..2f3f0988 100644
--- a/test/core/src/lombok/AbstractRunTests.java
+++ b/test/core/src/lombok/AbstractRunTests.java
@@ -68,10 +68,12 @@ public abstract class AbstractRunTests {
}
}
- StringReader r = new StringReader(expectedFile);
- BufferedReader br = new BufferedReader(r);
- String firstLine = br.readLine();
- if (firstLine != null && (firstLine.startsWith("//ignore") || params.shouldIgnoreBasedOnVersion(firstLine))) return false;
+ if (expectedFile != null) {
+ StringReader r = new StringReader(expectedFile);
+ BufferedReader br = new BufferedReader(r);
+ String firstLine = br.readLine();
+ if (firstLine != null && (firstLine.startsWith("//ignore") || params.shouldIgnoreBasedOnVersion(firstLine))) return false;
+ }
compare(
file.getName(),
@@ -91,7 +93,7 @@ public abstract class AbstractRunTests {
try {
reader = new BufferedReader(new FileReader(file));
} catch (FileNotFoundException e) {
- return "";
+ return null;
}
StringBuilder result = new StringBuilder();
String line;
@@ -104,7 +106,7 @@ public abstract class AbstractRunTests {
}
private String readFile(File dir, File file, boolean messages) throws IOException {
- if (dir == null) return "";
+ if (dir == null) return null;
return readFile(new File(dir, file.getName() + (messages ? ".messages" : "")));
}
@@ -140,7 +142,9 @@ public abstract class AbstractRunTests {
}
private void compare(String name, String expectedFile, String actualFile, List<CompilerMessageMatcher> expectedMessages, LinkedHashSet<CompilerMessage> actualMessages, boolean printErrors) throws Throwable {
- try {
+ if (expectedFile == null && expectedMessages.isEmpty()) expectedFile = "";
+
+ if (expectedFile != null) try {
compareContent(name, expectedFile, actualFile);
} catch (Throwable e) {
if (printErrors) {