Interface Failure
- All Known Subinterfaces:
FileComparisonTestAssertionFailure, TestAssertionFailure, TestFailure, TestFrameworkFailure
public interface Failure
Represents a failure. Failures are similar to exceptions but carry less information (only a message, a description and a cause) so
they can be used in a wider scope than just the JVM where the exception failed.
- Since:
- 2.4
-
Method Summary
Modifier and TypeMethodDescriptionReturns the underlying causes for this failure, if any.@Nullable StringReturns a long description of the failure.@Nullable StringReturns a short message (typically one line) for the failure.@Nullable StringReturns a long description of this failure node, excluding the descriptions of its causes.Returns the problems associated with this failure.
-
Method Details
-
getMessage
@Nullable String getMessage()Returns a short message (typically one line) for the failure.- Returns:
- the failure message
- Since:
- 2.4
-
getDescription
@Nullable String getDescription()Returns a long description of the failure. For example, a stack trace. Call this method on the root failure only: the description may include the full text of the failures returned bygetCauses(). When inspecting every node in a failure tree, usegetOwnDescription()to avoid processing cause descriptions repeatedly.- Returns:
- a long description of the failure
- Since:
- 2.4
-
getOwnDescription
Returns a long description of this failure node, excluding the descriptions of its causes. For example, the failure header, its stack frames, and any suppressed exceptions, but not the descriptions of the failures returned bygetCauses().Unlike
getDescription(), which may contain the text of the whole cause subtree, this method can be used to inspect the description of every node in a failure tree without processing cause descriptions repeatedly.When using a target Gradle version earlier than 9.7.0, this method returns
null.- Returns:
- a long description of this failure node, or
nullif it is not available - Since:
- 9.8.0
-
getCauses
-
getProblems
Returns the problems associated with this failure.- Returns:
- The problems, or an empty list if there are no problems.
- Since:
- 8.12
-