j2meunit.framework
Class TestResult

java.lang.Object
  |
  +--j2meunit.framework.TestResult

public class TestResult
extends java.lang.Object

A TestResult collects the results of executing a test case. It is an instance of the Collecting Parameter pattern. The test framework distinguishes between failures and errors. A failure is anticipated and checked for with assertions. Errors are unanticipated problems like an ArrayIndexOutOfBoundsException.

See Also:
Test

Field Summary
protected  int fAssertions
           
protected  java.util.Vector fErrors
           
protected  java.util.Vector fFailures
           
protected  java.util.Vector fListeners
           
protected  int fRunTests
           
 
Constructor Summary
TestResult()
          Creates a new TestResult object.
 
Method Summary
 void addError(Test test, java.lang.Throwable t)
          Adds an error to the list of errors.
 void addFailure(Test test, AssertionFailedError t)
          Adds a failure to the list of failures.
 void addListener(TestListener listener)
          Registers a TestListener
 int assertionCount()
          Gets the number of detected failures.
 void assertionMade()
          Adds a failure to the list of failures.
 void endTest(Test test)
          Informs the result that a test was completed.
 void endTestStep(Test test)
          Informs the result that a test was completed.
 int errorCount()
          Gets the number of detected errors.
 java.util.Enumeration errors()
          Returns an Enumeration for the errors
 int failureCount()
          Gets the number of detected failures.
 java.util.Enumeration failures()
          Returns an Enumeration for the failures
protected  void run(TestCase test)
          Runs a TestCase.
 int runCount()
          Gets the number of run tests.
 void runProtected(Test test, Protectable p)
          Runs a TestCase.
 int runTests()
          Deprecated. use runCount instead
 boolean shouldStop()
          Checks whether the test run should stop
 void startTest(Test test)
          Informs the result that a test will be started.
 void stop()
          Marks that the test run should stop.
 int testErrors()
          Deprecated. use errorCount instead
 int testFailures()
          Deprecated. use failureCount instead
 boolean wasSuccessful()
          Returns whether the entire test was successful or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fErrors

protected java.util.Vector fErrors

fFailures

protected java.util.Vector fFailures

fListeners

protected java.util.Vector fListeners

fAssertions

protected int fAssertions

fRunTests

protected int fRunTests
Constructor Detail

TestResult

public TestResult()
Creates a new TestResult object.

Method Detail

addError

public void addError(Test test,
                     java.lang.Throwable t)
Adds an error to the list of errors. The passed in exception caused the error.

Parameters:
test - -
t - -

addFailure

public void addFailure(Test test,
                       AssertionFailedError t)
Adds a failure to the list of failures. The passed in exception caused the failure.

Parameters:
test - -
t - -

addListener

public void addListener(TestListener listener)
Registers a TestListener

Parameters:
listener - The listener

assertionCount

public int assertionCount()
Gets the number of detected failures.

Returns:
-

assertionMade

public void assertionMade()
Adds a failure to the list of failures. The passed in exception caused the failure.


endTest

public void endTest(Test test)
Informs the result that a test was completed.

Parameters:
test - -

endTestStep

public void endTestStep(Test test)
Informs the result that a test was completed.

Parameters:
test - -

errorCount

public int errorCount()
Gets the number of detected errors.

Returns:
-

errors

public java.util.Enumeration errors()
Returns an Enumeration for the errors

Returns:
-

failureCount

public int failureCount()
Gets the number of detected failures.

Returns:
-

failures

public java.util.Enumeration failures()
Returns an Enumeration for the failures

Returns:
-

runCount

public int runCount()
Gets the number of run tests.

Returns:
-

runProtected

public void runProtected(Test test,
                         Protectable p)
Runs a TestCase.

Parameters:
test - -
p - -

runTests

public int runTests()
Deprecated. use runCount instead

Gets the number of run tests.

Returns:
-

shouldStop

public boolean shouldStop()
Checks whether the test run should stop

Returns:
-

startTest

public void startTest(Test test)
Informs the result that a test will be started.

Parameters:
test - -

stop

public void stop()
Marks that the test run should stop.


testErrors

public int testErrors()
Deprecated. use errorCount instead

Gets the number of detected errors.

Returns:
-

testFailures

public int testFailures()
Deprecated. use failureCount instead

Gets the number of detected failures.

Returns:
-

wasSuccessful

public boolean wasSuccessful()
Returns whether the entire test was successful or not.

Returns:
-

run

protected void run(TestCase test)
Runs a TestCase.

Parameters:
test - -