AROM-2_2_13

helix.util
Class TestResult

java.lang.Object
  |
  +--helix.util.TestResult

public class TestResult
extends Object

A TestResult collects the results of a test. This class can be used as a method parameter to collect the events (errors or failures) that prevent the method's execution of being successful.

Author:
Christophe Bruley

Constructor Summary
TestResult()
          Creates a new TestResult instance.
 
Method Summary
 void addError(Throwable t)
          Records the supplied error.
 void addFailure(String message)
          Records a new failure described by the supplied message.
 int errorCount()
          Returns the number of errors recorded by this test result.
 Iterator errors()
          Returns an iterator over the recorded errors.
 int failureCount()
          Returns the number of failures recorded by this test result.
 Iterator failures()
          Returns an iterator over the recorded failures.
 String toString()
          Returns a string representation of this test result.
 boolean wasSuccessful()
          Returns true if the test was successful.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestResult

public TestResult()
Creates a new TestResult instance.

Method Detail

addError

public void addError(Throwable t)
Records the supplied error.

Parameters:
t - a Throwable value

addFailure

public void addFailure(String message)
Records a new failure described by the supplied message.

Parameters:
message - a String value

errorCount

public int errorCount()
Returns the number of errors recorded by this test result.

Returns:
the number of errors

errors

public Iterator errors()
Returns an iterator over the recorded errors.

Returns:
an Iterator value

failureCount

public int failureCount()
Returns the number of failures recorded by this test result.

Returns:
the number of failures

failures

public Iterator failures()
Returns an iterator over the recorded failures.

Returns:
an Iterator value

wasSuccessful

public boolean wasSuccessful()
Returns true if the test was successful. A test is successful if no errors nor failures has been recorded.

Returns:
a boolean value

toString

public String toString()
Returns a string representation of this test result.

Overrides:
toString in class Object
Returns:
a String value

AROM-2_2_13