From f0585f4ed491eb455fe9484c735365463ae4184e Mon Sep 17 00:00:00 2001 From: Roel Spilker Date: Sun, 29 Nov 2009 01:19:14 +0100 Subject: Can now mark test files as Ignored --- test/core/src/lombok/DirectoryRunner.java | 24 +++++++++++++++++++++--- test/lombok/resource/before/CleanupPlain.java | 1 + test/lombok/resource/before/SetterPlain.java | 1 + 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/test/core/src/lombok/DirectoryRunner.java b/test/core/src/lombok/DirectoryRunner.java index 9905df04..40b21aa0 100644 --- a/test/core/src/lombok/DirectoryRunner.java +++ b/test/core/src/lombok/DirectoryRunner.java @@ -1,6 +1,10 @@ package lombok; +import java.io.BufferedReader; import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; import java.lang.reflect.Method; import java.util.Map; import java.util.TreeMap; @@ -62,7 +66,9 @@ public class DirectoryRunner extends Runner { Description testDescription = entry.getValue(); notifier.fireTestStarted(testDescription); try { - runTest(entry.getKey()); + if (!runTest(entry.getKey())) { + notifier.fireTestIgnored(testDescription); + } } catch (Throwable t) { notifier.fireTestFailure(new Failure(testDescription, t)); @@ -71,7 +77,19 @@ public class DirectoryRunner extends Runner { } } - private void runTest(String fileName) throws Throwable { - TestViaDelombok.compareFile(afterDirectory, new File(beforeDirectory, fileName)); + private boolean runTest(String fileName) throws Throwable { + File file = new File(beforeDirectory, fileName); + if (mustIgnore(file)) { + return false; + } + TestViaDelombok.compareFile(afterDirectory, file); + return true; + } + + private boolean mustIgnore(File file) throws FileNotFoundException, IOException { + BufferedReader reader = new BufferedReader(new FileReader(file)); + String line = reader.readLine(); + reader.close(); + return "//ignore".equals(line); } } diff --git a/test/lombok/resource/before/CleanupPlain.java b/test/lombok/resource/before/CleanupPlain.java index f463b152..6cf09062 100644 --- a/test/lombok/resource/before/CleanupPlain.java +++ b/test/lombok/resource/before/CleanupPlain.java @@ -1,3 +1,4 @@ +//ignore import lombok.Cleanup; import java.io.*; class Cleanup { diff --git a/test/lombok/resource/before/SetterPlain.java b/test/lombok/resource/before/SetterPlain.java index 482b5e05..85d3aad5 100644 --- a/test/lombok/resource/before/SetterPlain.java +++ b/test/lombok/resource/before/SetterPlain.java @@ -1,3 +1,4 @@ +//ignore import lombok.Setter; class Setter { @lombok.Setter int i; -- cgit