类 Failure
- java.lang.Object
- org.junit.runner.notification.Failure
- 所有已实现的接口:
Serializable
public class Failure extends Object implements Serializable
AFailureholds a description of the failed test and the exception that was thrown while running it. In most cases theDescriptionwill be of a single test. However, if problems are encountered while constructing the test (for example, if aBeforeClassmethod is not static), it may describe something other than a single test.- 从以下版本开始:
- 4.0
- 另请参阅:
- 序列化表格
构造器概要
构造器 构造器 说明 Failure(Description description, Throwable thrownException)Constructs aFailurewith the given description and exception.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 DescriptiongetDescription()ThrowablegetException()StringgetMessage()Convenience methodStringgetTestHeader()StringgetTrace()Convenience methodStringtoString()
构造器详细资料
Failure
public Failure(Description description, Throwable thrownException)
Constructs aFailurewith the given description and exception.- 参数:
description- aDescriptionof the test that failedthrownException- the exception that was thrown while running the test
方法详细资料
getTestHeader
public String getTestHeader()
- 返回:
- a user-understandable label for the test
getDescription
public Description getDescription()
- 返回:
- the raw description of the context of the failure.
getException
public Throwable getException()
- 返回:
- the exception thrown
getMessage
public String getMessage()
Convenience method- 返回:
- the message of the thrown exception