Package org.gradle.api.tasks.testing

# Interface TestFailureDetails

@Incubating public interface TestFailureDetails
Contains serializable structural information about a test failure.

Since:
  7.6
See Also:
  - `TestFailure`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `@Nullable String`
  `getActual()`
  Returns a string representation of the actual value for an assertion failure.
  `byte @Nullable []`
  `getActualContent()`
  Returns the actual content of a file comparison assertion failure.
  `String`
  `getClassName()`
  The fully-qualified name of the underlying exception type.
  `@Nullable String`
  `getExpected()`
  Returns a string representation of the expected value for an assertion failure.
  `byte @Nullable []`
  `getExpectedContent()`
  Returns the expected content of a file comparison assertion failure.
  `@Nullable String`
  `getMessage()`
  Returns the failure message.
  `String`
  `getStacktrace()`
  Returns the stacktrace of the failure.
  `boolean`
  `isAssertionFailure()`
  Returns true if the represented failure is recognized as an assertion failure.
  `boolean`
  `isAssumptionFailure()`
  Is this an assumption failure?
  `boolean`
  `isFileComparisonFailure()`
  Returns true if the represented failure is recognized as a file comparison failure.

- ## Method Details

  - ### getMessage

    @Nullable String getMessage()
    Returns the failure message.
    Returns:
      the failure message

  - ### getClassName

    String getClassName()
    The fully-qualified name of the underlying exception type.
    Returns:
      the class name

  - ### getStacktrace

    String getStacktrace()
    Returns the stacktrace of the failure.

    The instances are created on the test worker side allowing the clients not to deal with non-serializable exceptions.

    Returns:
      the stacktrace string

  - ### isAssertionFailure

    boolean isAssertionFailure()
    Returns true if the represented failure is recognized as an assertion failure.
    Returns:
      `true` for assertion failures

  - ### isFileComparisonFailure

    boolean isFileComparisonFailure()
    Returns true if the represented failure is recognized as a file comparison failure.

    If this field is `true`, then the `getExpectedContent()` and `getActualContent()` methods might return non-null values.

    Returns:
      `true` if this failure is a file comparison failure
    Since:
      8.3

  - ### getExpectedContent

    byte @Nullable [] getExpectedContent()
    Returns the expected content of a file comparison assertion failure.
    Returns:
      the expected file contents or `null` if the test framework doesn't supply detailed information on assertion failures, or it is not a file comparison failure
    Since:
      8.3
    See Also:
      - `isFileComparisonFailure()`

  - ### getActualContent

    byte @Nullable [] getActualContent()
    Returns the actual content of a file comparison assertion failure.
    Returns:
      the expected file contents or `null` if the test framework doesn't supply detailed information on assertion failures, or it is not a file comparison failure
    Since:
      8.3
    See Also:
      - `isFileComparisonFailure()`

  - ### getExpected

    @Nullable String getExpected()
    Returns a string representation of the expected value for an assertion failure.

    If the current instance does not represent an assertion failure, or the test failure doesn't provide any information about expected and actual values then the method returns `null`.

    Returns:
      The expected value

  - ### getActual

    @Nullable String getActual()
    Returns a string representation of the actual value for an assertion failure.

    If the current instance does not represent an assertion failure, or the test failure doesn't provide any information about expected and actual values then the method returns `null`.

    Returns:
      The actual value

  - ### isAssumptionFailure

    boolean isAssumptionFailure()
    Is this an assumption failure?
    Returns:
      true if this is an assumption failure
    Since:
      8.14