01: package com.reeltwo.jumble.fast;
02:
03: import java.util.Enumeration;
04: import junit.framework.TestFailure;
05: import junit.framework.TestResult;
06:
07: /**
08: * <code>JUnitTestResult</code> extends the standard
09: * <code>TestResult</code> class with a decent <code>toString</code>
10: * method.
11: *
12: * @author <a href="mailto:len@reeltwo.com">Len Trigg</a>
13: * @version $Revision: 496 $
14: */
15: public class JUnitTestResult extends TestResult {
16: private static final String LS = System
17: .getProperty("line.separator");
18:
19: public String toString() {
20: StringBuffer sb = new StringBuffer();
21: for (Enumeration e = errors(); e.hasMoreElements();) {
22: TestFailure f = (TestFailure) e.nextElement();
23: sb.append("TEST FINISHED WITH ERROR: ")
24: .append(f.toString()).append(LS);
25: sb.append(f.trace());
26: }
27: for (Enumeration e = failures(); e.hasMoreElements();) {
28: TestFailure f = (TestFailure) e.nextElement();
29: sb.append("TEST FINISHED WITH FAILURE: ").append(
30: f.toString()).append(LS);
31: sb.append(f.trace());
32: }
33: return sb.toString();
34: }
35: }
|