|
|
|
@@ -69,6 +69,9 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter { |
|
|
|
*/ |
|
|
|
private String systemError = null; |
|
|
|
|
|
|
|
/** |
|
|
|
* Constructor for BriefJUnitResultFormatter. |
|
|
|
*/ |
|
|
|
public BriefJUnitResultFormatter() { |
|
|
|
results = new StringWriter(); |
|
|
|
resultWriter = new PrintWriter(results); |
|
|
|
@@ -76,16 +79,23 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter { |
|
|
|
|
|
|
|
/** |
|
|
|
* Sets the stream the formatter is supposed to write its results to. |
|
|
|
* @param out the output stream to write to |
|
|
|
*/ |
|
|
|
public void setOutput(OutputStream out) { |
|
|
|
this.out = out; |
|
|
|
output = new PrintWriter(out); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @see JUnitResultFormatter#setSystemOutput(String) |
|
|
|
*/ |
|
|
|
public void setSystemOutput(String out) { |
|
|
|
systemOutput = out; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @see JUnitResultFormatter#setSystemError(String) |
|
|
|
*/ |
|
|
|
public void setSystemError(String err) { |
|
|
|
systemError = err; |
|
|
|
} |
|
|
|
@@ -162,12 +172,14 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter { |
|
|
|
|
|
|
|
/** |
|
|
|
* A test started. |
|
|
|
* @param test a test |
|
|
|
*/ |
|
|
|
public void startTest(Test test) { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* A test ended. |
|
|
|
* @param test a test |
|
|
|
*/ |
|
|
|
public void endTest(Test test) { |
|
|
|
} |
|
|
|
@@ -176,6 +188,8 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter { |
|
|
|
* Interface TestListener for JUnit <= 3.4. |
|
|
|
* |
|
|
|
* <p>A Test failed. |
|
|
|
* @param test a test |
|
|
|
* @param t the exception thrown by the test |
|
|
|
*/ |
|
|
|
public void addFailure(Test test, Throwable t) { |
|
|
|
formatError("\tFAILED", test, t); |
|
|
|
@@ -185,6 +199,8 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter { |
|
|
|
* Interface TestListener for JUnit > 3.4. |
|
|
|
* |
|
|
|
* <p>A Test failed. |
|
|
|
* @param test a test |
|
|
|
* @param t the assertion failed by the test |
|
|
|
*/ |
|
|
|
public void addFailure(Test test, AssertionFailedError t) { |
|
|
|
addFailure(test, (Throwable) t); |
|
|
|
@@ -192,6 +208,8 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter { |
|
|
|
|
|
|
|
/** |
|
|
|
* A test caused an error. |
|
|
|
* @param test a test |
|
|
|
* @param error the error thrown by the test |
|
|
|
*/ |
|
|
|
public void addError(Test test, Throwable error) { |
|
|
|
formatError("\tCaused an ERROR", test, error); |
|
|
|
@@ -199,6 +217,8 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter { |
|
|
|
|
|
|
|
/** |
|
|
|
* Format the test for printing.. |
|
|
|
* @param test a test |
|
|
|
* @return the formatted testname |
|
|
|
*/ |
|
|
|
protected String formatTest(Test test) { |
|
|
|
if (test == null) { |
|
|
|
@@ -210,6 +230,9 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter { |
|
|
|
|
|
|
|
/** |
|
|
|
* Format an error and print it. |
|
|
|
* @param type the type of error |
|
|
|
* @param test the test that failed |
|
|
|
* @param error the exception that the test threw |
|
|
|
*/ |
|
|
|
protected synchronized void formatError(String type, Test test, |
|
|
|
Throwable error) { |
|
|
|
|