Name
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.
Declaration
public class TestFailure extends Object
Constructors
-
TestFailure(Test failedTest, Throwable thrownException)
Constructs a
TestFailure
for aTest
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 ofAssertionFailedError
. IfFALSE
, 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.
Get Unit Test Frameworks now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.