Failure (JUnit API)

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.junit.runner.notification
Class Failure

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

    public class Failure

extends java.lang.Object

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.

Constructor Summary
`Failure(Description description, java.lang.Throwable thrownException)` Constructs a `Failure` with the given description and exception.

Method Summary
`Description` | `getDescription()`
`java.lang.Throwable` | `getException()`
`java.lang.String` | `getMessage()` Convenience method
`java.lang.String` | `getTestHeader()`
`java.lang.String` | `getTrace()` Convenience method
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Failure

    public Failure(Description description,
                   java.lang.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

Method Detail

### getTestHeader

    public java.lang.String getTestHeader()

  Returns:
    a user-understandable label for the test

### getDescription

    public Description getDescription()

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

### getException

    public java.lang.Throwable getException()

  Returns:
    the exception thrown

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### getTrace

    public java.lang.String getTrace()

  Convenience method

  Returns:
    the printed form of the exception

### getMessage

    public java.lang.String getMessage()

  Convenience method

  Returns:
    the message of the thrown exception

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD