momeunit.framework
Class TestResult

java.lang.Object
  extended by momeunit.framework.TestResult

public class TestResult
extends Object

A class that collects the results of execution of tests.

Version:
1.1.2
Author:
Sergio Morozov
See Also:
Test, TestCase, TestSuite

Field Summary
protected  Vector errors
          Collection of exceptions (except AssertionFailedError thrown while executing tests.
protected  Vector failures
          Collection of tests failures.
protected  TestListener listener
          Registered test listener.
protected  int runTests
          Number of tests run.
 
Constructor Summary
TestResult()
          Instantiates TestResult.
 
Method Summary
 void addError(Test test, Throwable t)
          Adds a Throwable thrown while executing test to the list of errors.
 void addFailure(Test test, AssertionFailedError t)
          Adds a failure of test to the list of failures.
 void endTest(Test test)
          Informs the result that a test was completed.
 int errorCount()
          Returns the number of detected errors.
 Enumeration errors()
          Returns Enumeration of detected errors.
 int failureCount()
          Returns the number of detected failures.
 Enumeration failures()
          Returns an Enumeration of detected failures.
protected  void run(TestCase test)
          Runs specified TestCase.
 int runCount()
          Returns the number of tests run.
 void setListener(TestListener listener)
          Registers a TestListener with this TestResult.
 boolean shouldStop()
          Checks whether the test run should stop.
 void startTest(Test test)
          Informs the result that a test will be started.
 void stop()
          Notifies that the test run should stop.
 boolean wasSuccessful()
          Checks 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

failures

protected Vector failures
Collection of tests failures.

Since:
1.0

errors

protected Vector errors
Collection of exceptions (except AssertionFailedError thrown while executing tests.

Since:
1.0

listener

protected TestListener listener
Registered test listener.

Since:
1.0

runTests

protected int runTests
Number of tests run.

Since:
1.0
Constructor Detail

TestResult

public TestResult()
Instantiates TestResult.

Since:
1.0
Method Detail

addError

public void addError(Test test,
                     Throwable t)
Adds a Throwable thrown while executing test to the list of errors.

Parameters:
test - test that throws specified Throwable.
t - Throwable to be added to the list of errors.
Since:
1.0

addFailure

public void addFailure(Test test,
                       AssertionFailedError t)
Adds a failure of test to the list of failures.

Parameters:
test - test that fails.
t - AssertionFailedError thrown from failed assertion.
Since:
1.0

setListener

public void setListener(TestListener listener)
Registers a TestListener with this TestResult.

Parameters:
listener - TestListener instance to be registered with this TestResult.
Since:
1.0

endTest

public void endTest(Test test)
Informs the result that a test was completed. Notifies registered TestListener about the end of test.

Parameters:
test - test that ends.
Since:
1.0

errorCount

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

Returns:
number of detected errors.
Since:
1.0

errors

public Enumeration errors()
Returns Enumeration of detected errors.

Returns:
Enumeration of detected errors.
Since:
1.0

failureCount

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

Returns:
number of detected failures.
Since:
1.0

failures

public Enumeration failures()
Returns an Enumeration of detected failures.

Returns:
Enumeration of detected failures.
Since:
1.0

run

protected void run(TestCase test)
Runs specified TestCase.

Parameters:
test - TestCase instance to be run.
Since:
1.0

runCount

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

Returns:
number of tests run.
Since:
1.0

shouldStop

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

Returns:
true if test run should stop, false otherwise.
Since:
1.0

startTest

public void startTest(Test test)
Informs the result that a test will be started. Notifies registered TestListener about the start of test.

Parameters:
test - test to be run.
Since:
1.0

stop

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

Since:
1.0

wasSuccessful

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

Returns:
true if the entire test was successful, false otherwise.
Since:
1.0