diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2021-03-19 03:05:25 +0100 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2021-03-19 03:17:39 +0100 |
commit | 937a4dfca209d30e567a4c4fcbc9fe868221680a (patch) | |
tree | b11cc26d2bb74f8ca59750cc904e344e5f5fa8f5 /src/ant | |
parent | 5241235b99286243d02463adc7f8b0fd3d9ab5b4 (diff) | |
download | lombok-937a4dfca209d30e567a4c4fcbc9fe868221680a.tar.gz lombok-937a4dfca209d30e567a4c4fcbc9fe868221680a.tar.bz2 lombok-937a4dfca209d30e567a4c4fcbc9fe868221680a.zip |
[jdk16] fix delombok (and the test suite, which depends on it) for jdk16.
Diffstat (limited to 'src/ant')
-rw-r--r-- | src/ant/lombok/ant/SimpleTestFormatter.java | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/ant/lombok/ant/SimpleTestFormatter.java b/src/ant/lombok/ant/SimpleTestFormatter.java new file mode 100644 index 00000000..a2a38420 --- /dev/null +++ b/src/ant/lombok/ant/SimpleTestFormatter.java @@ -0,0 +1,63 @@ +package lombok.ant; + +import java.io.OutputStream; +import java.io.PrintStream; + +import junit.framework.AssertionFailedError; +import junit.framework.Test; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.taskdefs.optional.junit.JUnitResultFormatter; +import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest; + +public class SimpleTestFormatter implements JUnitResultFormatter { + private PrintStream out = System.out; + + @Override + public void addError(Test test, Throwable error) { + logResult(test, "ERR"); + out.println(error.getMessage()); + } + + @Override + public void addFailure(Test test, AssertionFailedError failure) { + logResult(test, "FAIL"); + out.println(failure.getMessage()); + } + + @Override + public void endTest(Test test) { + logResult(test, "PASS"); + } + + @Override + public void startTest(Test test) { } + + @Override + public void endTestSuite(JUnitTest testSuite) throws BuildException { } + + @Override + public void setOutput(OutputStream out) { + this.out = new PrintStream(out); + } + + @Override + public void setSystemError(String msg) { + if (msg.trim().isEmpty()) return; + out.println(msg); + } + + @Override + public void setSystemOutput(String msg) { + if (msg.trim().isEmpty()) return; + out.println(msg); + } + + @Override + public void startTestSuite(JUnitTest testSuite) throws BuildException { } + + private void logResult(Test test, String result) { + out.println("[" + result + "] " + String.valueOf(test)); + out.flush(); + } +} |