public class

Failure

extends Object
java.lang.Object
   ↳ org.junit.runner.notification.Failure

Class Overview

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.

Summary

Public Constructors
Failure(Description description, Throwable thrownException)
Constructs a Failure with the given description and exception.
Public Methods
Description getDescription()
Throwable getException()
String getMessage()
Convenience method
String getTestHeader()
String getTrace()
Convenience method
String toString()
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Failure (Description description, Throwable thrownException)

Constructs a Failure with the given description and exception.

Parameters
description a Description of the test that failed
thrownException the exception that was thrown while running the test

Public Methods

public Description getDescription ()

Returns
  • the raw description of the context of the failure.

public Throwable getException ()

Returns
  • the exception thrown

public String getMessage ()

Convenience method

Returns
  • the message of the thrown exception

public String getTestHeader ()

Returns
  • a user-understandable label for the test

public String getTrace ()

Convenience method

Returns
  • the printed form of the exception

public String toString ()