org.momeunit.ant.formatter
Class TestErrorIndicator

java.lang.Object
  extended by org.momeunit.ant.event.TestEventListener
      extended by org.momeunit.ant.formatter.UnitResultFormatter
          extended by org.momeunit.ant.formatter.TestErrorIndicator

public class TestErrorIndicator
extends UnitResultFormatter

Indicates if an error or failure occurred during tests run. Processes results of tests run. Contains methods for querying whether an error or failure occurred hasErrors() and hasFailures(); accessing last error message getErrorMessage(); accessing last failure message getFailureMessage(). Contains methods setSummary(boolean) and setWithOutAndErr(boolean) to specify whether to print summary (with system error and output produced).

Version:
1.1.2
Author:
Sergio Morozov

Field Summary
 
Fields inherited from class org.momeunit.ant.formatter.UnitResultFormatter
DEFAULT_ENCODING
 
Constructor Summary
TestErrorIndicator()
          Instantiates TestErrorIndicator.
TestErrorIndicator(org.apache.tools.ant.Task owner)
          Instantiates TestErrorIndicator with owning task.
TestErrorIndicator(org.apache.tools.ant.Task owner, boolean summary)
          Instantiates TestErrorIndicator with owning task and given printsummary functionality.
TestErrorIndicator(org.apache.tools.ant.Task owner, boolean summary, boolean withOutAndErr)
          Instantiates TestErrorIndicator with owning task and given printsummary functionality.
 
Method Summary
 void addError(TestEvent event)
          Callback method that indicates an error while executing test.
 void addFailure(TestEvent event)
          Callback method that indicates test failure.
 void endTest(TestEvent event)
          Callback method that indicates the end of test run.
 void endTestSuite()
          Callback method that indicates the end of tests run.
 String getErrorMessage()
          Returns last error message.
 String getFailureMessage()
          Returns last failure message.
 boolean hasErrors()
          Whether some test threw an error.
 boolean hasFailures()
          Whether some test failed.
 void setOwner(org.apache.tools.ant.Task owner)
          Sets owning task.
 void setSummary(boolean summary)
          Sets whether to print short summary.
 void setWithOutAndErr(boolean withOutAndErr)
          Sets whether include system output and system error produced by emulator and tests run.
 void startTest(TestEvent event)
          Callback method that indicates the start of test run.
 
Methods inherited from class org.momeunit.ant.formatter.UnitResultFormatter
filterStackTrace, getEncoding, getOutput, getSystemError, getSystemOutput, getTestSuiteName, isFilterTrace, setEncoding, setFilterTrace, setOutput, setSystemError, setSystemOutput, startTestSuite
 
Methods inherited from class org.momeunit.ant.event.TestEventListener
onEvevnt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestErrorIndicator

public TestErrorIndicator(org.apache.tools.ant.Task owner,
                          boolean summary,
                          boolean withOutAndErr)
Instantiates TestErrorIndicator with owning task and given printsummary functionality.

Parameters:
owner - owning task.
summary - whether to print short summary.
withOutAndErr - whether include system output and system error produced by emulator and tests run.
Since:
1.1

TestErrorIndicator

public TestErrorIndicator(org.apache.tools.ant.Task owner,
                          boolean summary)
Instantiates TestErrorIndicator with owning task and given printsummary functionality. Didn't include system output and system error produced by emulator and tests run.

Parameters:
owner - owning task.
summary - whether to print short summary.
Since:
1.1

TestErrorIndicator

public TestErrorIndicator(org.apache.tools.ant.Task owner)
Instantiates TestErrorIndicator with owning task.

Parameters:
owner - owning task.
Since:
1.1

TestErrorIndicator

public TestErrorIndicator()
Instantiates TestErrorIndicator.

Since:
1.1
Method Detail

setSummary

public void setSummary(boolean summary)
Sets whether to print short summary.

Parameters:
summary - boolean that indicates whether to print short summary.
Since:
1.1

setOwner

public void setOwner(org.apache.tools.ant.Task owner)
Sets owning task.

Parameters:
owner - owning task.
Since:
1.1

setWithOutAndErr

public void setWithOutAndErr(boolean withOutAndErr)
Sets whether include system output and system error produced by emulator and tests run.

Parameters:
withOutAndErr - boolean that indicates whether include system output and system error produced by emulator and tests run.
Since:
1.1

addError

public void addError(TestEvent event)
Description copied from class: TestEventListener
Callback method that indicates an error while executing test.

Specified by:
addError in class TestEventListener
Parameters:
event - test event of error while executing test.

addFailure

public void addFailure(TestEvent event)
Description copied from class: TestEventListener
Callback method that indicates test failure.

Specified by:
addFailure in class TestEventListener
Parameters:
event - test event of test failure.

endTest

public void endTest(TestEvent event)
Description copied from class: TestEventListener
Callback method that indicates the end of test run.

Specified by:
endTest in class TestEventListener
Parameters:
event - test event of end of test run.

startTest

public void startTest(TestEvent event)
Description copied from class: TestEventListener
Callback method that indicates the start of test run.

Specified by:
startTest in class TestEventListener
Parameters:
event - test event of start of test run.

getErrorMessage

public String getErrorMessage()
Returns last error message.

Returns:
the last error message.
Since:
1.1

getFailureMessage

public String getFailureMessage()
Returns last failure message.

Returns:
the last failure message.
Since:
1.1

hasErrors

public boolean hasErrors()
Whether some test threw an error.

Returns:
true if some test threw an error, false otherwise.
Since:
1.1

hasFailures

public boolean hasFailures()
Whether some test failed.

Returns:
true if some test failed, false otherwise.
Since:
1.1

endTestSuite

public void endTestSuite()
Description copied from class: UnitResultFormatter
Callback method that indicates the end of tests run.

Overrides:
endTestSuite in class UnitResultFormatter