public class Failure
extends java.lang.Object
implements java.io.Serializable
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.Modifier and Type | Field and Description |
---|---|
private Description |
fDescription |
private java.lang.Throwable |
fThrownException |
private static long |
serialVersionUID |
Constructor and Description |
---|
Failure(Description description,
java.lang.Throwable thrownException)
Constructs a
Failure with the given description and exception. |
Modifier and Type | Method and Description |
---|---|
Description |
getDescription() |
java.lang.Throwable |
getException() |
java.lang.String |
getMessage()
Convenience method
|
java.lang.String |
getTestHeader() |
java.lang.String |
getTrace()
Gets the printed form of the exception and its stack trace.
|
java.lang.String |
getTrimmedTrace()
Gets a the printed form of the exception, with a trimmed version of the stack trace.
|
java.lang.String |
toString() |
private static final long serialVersionUID
private final Description fDescription
private final java.lang.Throwable fThrownException
public Failure(Description description, java.lang.Throwable thrownException)
Failure
with the given description and exception.description
- a Description
of the test that failedthrownException
- the exception that was thrown while running the testpublic java.lang.String getTestHeader()
public Description getDescription()
public java.lang.Throwable getException()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getTrace()
public java.lang.String getTrimmedTrace()
public java.lang.String getMessage()