Package org.junit.runner.notification
Class Failure
java.lang.Object
org.junit.runner.notification.Failure
- All Implemented Interfaces:
Serializable
A
Failure
holds a description of the failed test and the
exception that was thrown while running it. In most cases the Description
will be of a single test. However, if problems are encountered while constructing the
test (for example, if a BeforeClass
method is not static), it may describe
something other than a single test.- Since:
- 4.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Description
private final Throwable
private static final long
-
Constructor Summary
ConstructorsConstructorDescriptionFailure
(Description description, Throwable thrownException) Constructs aFailure
with the given description and exception. -
Method Summary
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
fDescription
-
fThrownException
-
-
Constructor Details
-
Failure
Constructs aFailure
with the given description and exception.- Parameters:
description
- aDescription
of the test that failedthrownException
- the exception that was thrown while running the test
-
-
Method Details
-
getTestHeader
- Returns:
- a user-understandable label for the test
-
getDescription
- Returns:
- the raw description of the context of the failure.
-
getException
- Returns:
- the exception thrown
-
toString
-
getTrace
Gets the printed form of the exception and its stack trace. -
getTrimmedTrace
Gets a the printed form of the exception, with a trimmed version of the stack trace. This method will attempt to filter out frames of the stack trace that are below the test method call. -
getMessage
Convenience method- Returns:
- the message of the thrown exception
-