1 2 3 7 package org.quilt.reports; 8 9 import java.io.IOException ; 10 import java.io.OutputStream ; 11 import java.io.PrintWriter ; 12 import java.io.StringWriter ; 13 import java.text.NumberFormat ; 14 15 import junit.framework.*; 16 17 import org.apache.tools.ant.BuildException; 18 19 import org.quilt.framework.*; 20 import org.quilt.runner.Runner; 21 22 25 public abstract class BaseFormatter implements Formatter { 26 27 protected boolean filtertrace = true; 28 protected NumberFormat numberFormat = NumberFormat.getInstance(); 29 protected OutputStream out; 30 protected PrintWriter output; 31 protected Runner runner = null; 32 protected StringWriter results; 33 protected PrintWriter resultWriter; 34 protected String systemError = null; 35 protected String systemOutput = null; 36 37 45 public static String getTestName (Test test) { 46 if ( test instanceof TestSuite ) { 47 return ( (TestSuite) test ) . getName(); 48 } else if ( test instanceof TestCase ) { 49 return ( (TestCase) test ) . getName(); 50 } else { 51 return "unknown"; 52 } 53 } 54 58 59 public void endTestSuite(QuiltTest suite) throws BuildException {} 60 61 62 public void setFiltertrace (boolean b) { 63 filtertrace = b; 64 } 65 66 67 public void setOutput(OutputStream out) { 68 this.out = out; 69 output = new PrintWriter (out); 70 } 71 72 73 public void setRunner(Runner testrunner) { 74 runner = testrunner; 75 } 76 77 78 public void setSystemOutput(String out) { 79 systemOutput = out; 80 } 81 82 83 public void setSystemError(String err) { 84 systemError = err; 85 } 86 87 88 public void startTestSuite(QuiltTest suite) throws BuildException {} 89 90 93 94 public void addError(Test test, Throwable error) {} 95 96 97 public void addFailure(Test test, Throwable t) {} 98 99 100 public void addFailure(Test test, AssertionFailedError t) { 101 addFailure(test, (Throwable ) t); 102 } 103 104 108 public void startTest(Test test) { } 109 113 public void endTest(Test test) { } 114 } 115 | Popular Tags |