TestFailure

   
TestFailure

Description

TestFailure (see Figure B-7) is a class containing a Test and an associated exception. TestResult produces a TestFailure whenever there is a test failure or error.

Figure B-7. The class TestFailure
figs/utf_ab07.gif

Declaration

 public class TestFailure extends Object 

Constructors


TestFailure(Test failedTest, Throwable thrownException)

Constructs a TestFailure for a Test and its exception.

Public Methods


String exceptionMessage( )

Gets the exception message.


Test failedTest( )

Gets the failed test.


boolean isFailure( )

Returns TRUE if the exception is a failure represented by an instance of AssertionFailedError . If FALSE , the test produced an error.


Throwable thrownException( )

Gets the exception.


String toString( )

Returns a description of the failure consisting of the string Test.toString( ) and the exception message.


String trace( )

Returns the stack trace for the exception.

Protected/Private Methods

None.

Attributes


protected Test fFailedTest

protected Throwable fThrownException

These attributes contain the Test and the exception.



Unit Test Frameworks
Unit Test Frameworks
ISBN: 0596006896
EAN: 2147483647
Year: 2006
Pages: 146
Authors: Paul Hamill

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net