aboutsummaryrefslogtreecommitdiff
path: root/test/core/src/lombok
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2012-08-06 20:37:21 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2012-08-06 20:37:21 +0200
commit87f763a94c87b03da269d110c44e7e750ddf5211 (patch)
tree05d59604320510e4bb7d5014917ba275e9061e5a /test/core/src/lombok
parenteb4cbcd8bbd7bf7784aa229e9b6c5fe0670fa7a5 (diff)
parent34055fcdff786c9b809ce1a08c1c9218968ebc7d (diff)
downloadlombok-87f763a94c87b03da269d110c44e7e750ddf5211.tar.gz
lombok-87f763a94c87b03da269d110c44e7e750ddf5211.tar.bz2
lombok-87f763a94c87b03da269d110c44e7e750ddf5211.zip
Merge branch 'master' into wither
Conflicts: src/core/lombok/javac/handlers/JavacHandlerUtil.java
Diffstat (limited to 'test/core/src/lombok')
-rw-r--r--test/core/src/lombok/AbstractRunTests.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/core/src/lombok/AbstractRunTests.java b/test/core/src/lombok/AbstractRunTests.java
index b2200bbd..02c4803a 100644
--- a/test/core/src/lombok/AbstractRunTests.java
+++ b/test/core/src/lombok/AbstractRunTests.java
@@ -26,6 +26,7 @@ import static org.junit.Assert.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.StringReader;
@@ -35,6 +36,11 @@ import java.util.List;
public abstract class AbstractRunTests {
protected static final String LINE_SEPARATOR = System.getProperty("line.separator");
+ private final File dumpActualFilesHere;
+
+ public AbstractRunTests() {
+ this.dumpActualFilesHere = findPlaceToDumpActualFiles();
+ }
public boolean compareFile(DirectoryRunner.TestParams params, File file) throws Throwable {
StringBuilder messages = new StringBuilder();
@@ -82,6 +88,25 @@ public abstract class AbstractRunTests {
return readFile(new File(dir, file.getName() + (messages ? ".messages" : "")));
}
+ private static File findPlaceToDumpActualFiles() {
+ String location = System.getProperty("lombok.tests.dump_actual_files");
+ if (location != null) {
+ File dumpActualFilesHere = new File(location);
+ dumpActualFilesHere.mkdirs();
+ return dumpActualFilesHere;
+ }
+ return null;
+ }
+
+ private static void dumpToFile(File file, String content) throws IOException {
+ FileOutputStream fos = new FileOutputStream(file);
+ try {
+ fos.write(content.getBytes("UTF-8"));
+ } finally {
+ fos.close();
+ }
+ }
+
private void compare(String name, String expectedFile, String actualFile, String expectedMessages, String actualMessages, boolean printErrors) throws Throwable {
try {
compareContent(name, expectedFile, actualFile);
@@ -99,6 +124,9 @@ public abstract class AbstractRunTests {
}
System.out.println("*******************");
}
+ if (dumpActualFilesHere != null) {
+ dumpToFile(new File(dumpActualFilesHere, name), actualFile);
+ }
throw e;
}
try {
@@ -113,6 +141,9 @@ public abstract class AbstractRunTests {
System.out.println(actualMessages);
System.out.println("*******************");
}
+ if (dumpActualFilesHere != null) {
+ dumpToFile(new File(dumpActualFilesHere, name + ".messages"), actualMessages);
+ }
throw e;
}
}