org.momeunit.ant.formatter
Class UnitResultFormatter

java.lang.Object
  extended by org.momeunit.ant.event.TestEventListener
      extended by org.momeunit.ant.formatter.UnitResultFormatter
Direct Known Subclasses:
BriefUnitResultFormatter, TestErrorIndicator, XMLUnitResultFormatter

public abstract class UnitResultFormatter
extends TestEventListener

The abstract base class of every formatter. Extends TestEventListener. Contains callback methods startTestSuite(String), TestEventListener.startTest(org.momeunit.ant.event.TestEvent), TestEventListener.addError(org.momeunit.ant.event.TestEvent), TestEventListener.addFailure(org.momeunit.ant.event.TestEvent), TestEventListener.endTest(org.momeunit.ant.event.TestEvent) and endTestSuite() that formatter should implement for processing test events and creating report. Contains base and utility methods that formatter can use in generating report.

Version:
1.1.2
Author:
Sergio Morozov

Field Summary
static String DEFAULT_ENCODING
          Default encoding of report.
 
Constructor Summary
UnitResultFormatter()
           
 
Method Summary
 void endTestSuite()
          Callback method that indicates the end of tests run.
static String filterStackTrace(String stackTrace)
          Utility method that excludes momeunit and mome stack frames from given stack trace.
 String getEncoding()
          Returns encoding of generated report.
 OutputStream getOutput()
          Returns OutputStream where formatter sends report.
 String getSystemError()
          Returns error output generated by tests run and emulator.
 String getSystemOutput()
          Returns output generated by tests run and emulator.
 String getTestSuiteName()
          Returns test suite name.
 boolean isFilterTrace()
          Returns whether to filter momeunit and mome stack frames from stack trace.
 void setEncoding(String encoding)
          Sets encoding of report.
 void setFilterTrace(boolean filterTrace)
          Sets whether to filter momeunit and mome stack frames from stack trace.
 void setOutput(OutputStream out)
          Sets OutputStream where formatter sends report.
 void setSystemError(String err)
          Sets error output generated by tests run and emulator.
 void setSystemOutput(String out)
          Sets output generated by tests run and emulator.
 void startTestSuite(String name)
          Callback method that indicates the start of tests run.
 
Methods inherited from class org.momeunit.ant.event.TestEventListener
addError, addFailure, endTest, onEvevnt, startTest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ENCODING

public static final String DEFAULT_ENCODING
Default encoding of report.

Since:
1.1
See Also:
Constant Field Values
Constructor Detail

UnitResultFormatter

public UnitResultFormatter()
Method Detail

getEncoding

public String getEncoding()
Returns encoding of generated report.

Returns:
the encoding of generated report.
Since:
1.1

setEncoding

public void setEncoding(String encoding)
Sets encoding of report.

Parameters:
encoding - the encoding to use in generating report.
Since:
1.1

setOutput

public void setOutput(OutputStream out)
Sets OutputStream where formatter sends report.

Parameters:
out - the out used to create report.
Since:
1.1

setSystemOutput

public void setSystemOutput(String out)
Sets output generated by tests run and emulator.

Parameters:
out - output generated by tests run and emulator.
Since:
1.1

setSystemError

public void setSystemError(String err)
Sets error output generated by tests run and emulator.

Parameters:
err - error output generated by tests run and emulator.
Since:
1.1

setFilterTrace

public void setFilterTrace(boolean filterTrace)
Sets whether to filter momeunit and mome stack frames from stack trace.

Parameters:
filterTrace - filtertrace flag to set.
Since:
1.1

isFilterTrace

public boolean isFilterTrace()
Returns whether to filter momeunit and mome stack frames from stack trace.

Returns:
the filtertrace flag.
Since:
1.1

getOutput

public OutputStream getOutput()
Returns OutputStream where formatter sends report.

Returns:
OutputStream where formatter sends report.
Since:
1.1

getSystemError

public String getSystemError()
Returns error output generated by tests run and emulator.

Returns:
error output generated by tests run and emulator.
Since:
1.1

getSystemOutput

public String getSystemOutput()
Returns output generated by tests run and emulator.

Returns:
output generated by tests run and emulator.
Since:
1.1

startTestSuite

public void startTestSuite(String name)
Callback method that indicates the start of tests run.

Parameters:
name - name of test suite that runs.
Since:
1.1

getTestSuiteName

public String getTestSuiteName()
Returns test suite name.

Returns:
test suite name.
Since:
1.1

endTestSuite

public void endTestSuite()
Callback method that indicates the end of tests run.

Since:
1.1

filterStackTrace

public static String filterStackTrace(String stackTrace)
Utility method that excludes momeunit and mome stack frames from given stack trace.

Parameters:
stackTrace - stack trace to excludes momeunit and mome stack frames from.
Returns:
stack trace with momeunit and mome stack frames excluded.
Since:
1.1