org.apache.tools.ant.taskdefs.optional.junit
Class TearDownOnVmCrash

java.lang.Object
  extended by org.apache.tools.ant.taskdefs.optional.junit.TearDownOnVmCrash
All Implemented Interfaces:
junit.framework.TestListener, JUnitResultFormatter, JUnitTaskMirror.JUnitResultFormatterMirror

public class TearDownOnVmCrash
extends java.lang.Object
implements JUnitResultFormatter

Formatter that doesn't create any output but tries to invoke the tearDown method on a testcase if that test was forked and caused a timeout or VM crash.

This formatter has some limitations, for details see the <junit> task's manual.

Since:
Ant 1.8.0

Constructor Summary
TearDownOnVmCrash()
           
 
Method Summary
 void addError(junit.framework.Test fakeTest, java.lang.Throwable t)
          Only invoke tearDown if the suite is known and not the dummy test we get when a Batch fails and the error is an actual error generated by Ant.
 void addFailure(junit.framework.Test test, junit.framework.AssertionFailedError t)
           
 void addFailure(junit.framework.Test test, java.lang.Throwable t)
           
 void endTest(junit.framework.Test test)
           
 void endTestSuite(JUnitTest suite)
          The whole testsuite ended.
 void setOutput(java.io.OutputStream out)
          Sets the stream the formatter is supposed to write its results to.
 void setSystemError(java.lang.String err)
          This is what the test has written to System.err
 void setSystemOutput(java.lang.String out)
          This is what the test has written to System.out
 void startTest(junit.framework.Test test)
           
 void startTestSuite(JUnitTest suite)
          Records the suite's name to later determine the class to invoke tearDown on.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TearDownOnVmCrash

public TearDownOnVmCrash()
Method Detail

startTestSuite

public void startTestSuite(JUnitTest suite)
Records the suite's name to later determine the class to invoke tearDown on.

Specified by:
startTestSuite in interface JUnitResultFormatter
Parameters:
suite - the suite.

addError

public void addError(junit.framework.Test fakeTest,
                     java.lang.Throwable t)
Only invoke tearDown if the suite is known and not the dummy test we get when a Batch fails and the error is an actual error generated by Ant.

Specified by:
addError in interface junit.framework.TestListener

addFailure

public void addFailure(junit.framework.Test test,
                       java.lang.Throwable t)

addFailure

public void addFailure(junit.framework.Test test,
                       junit.framework.AssertionFailedError t)
Specified by:
addFailure in interface junit.framework.TestListener

startTest

public void startTest(junit.framework.Test test)
Specified by:
startTest in interface junit.framework.TestListener

endTest

public void endTest(junit.framework.Test test)
Specified by:
endTest in interface junit.framework.TestListener

endTestSuite

public void endTestSuite(JUnitTest suite)
Description copied from interface: JUnitResultFormatter
The whole testsuite ended.

Specified by:
endTestSuite in interface JUnitResultFormatter
Parameters:
suite - the suite.

setOutput

public void setOutput(java.io.OutputStream out)
Description copied from interface: JUnitResultFormatter
Sets the stream the formatter is supposed to write its results to.

Specified by:
setOutput in interface JUnitResultFormatter
Specified by:
setOutput in interface JUnitTaskMirror.JUnitResultFormatterMirror
Parameters:
out - the output stream to use.

setSystemOutput

public void setSystemOutput(java.lang.String out)
Description copied from interface: JUnitResultFormatter
This is what the test has written to System.out

Specified by:
setSystemOutput in interface JUnitResultFormatter
Parameters:
out - the string to write.

setSystemError

public void setSystemError(java.lang.String err)
Description copied from interface: JUnitResultFormatter
This is what the test has written to System.err

Specified by:
setSystemError in interface JUnitResultFormatter
Parameters:
err - the string to write.