Package org.gradle.api.tasks.testing
Class TestFailure
- java.lang.Object
-
- org.gradle.api.tasks.testing.TestFailure
-
@Incubating public abstract class TestFailure extends java.lang.Object
Describes a test failure. Contains a reference to the failure and some structural information retrieved by the test worker.- Since:
- 7.6
-
-
Constructor Summary
Constructors Constructor Description TestFailure()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static TestFailure
fromFileComparisonFailure(java.lang.Throwable failure, java.lang.String expected, java.lang.String actual, byte[] expectedContent, byte[] actualContent, java.util.List<TestFailure> causes)
Todostatic TestFailure
fromTestAssertionFailure(java.lang.Throwable failure, java.lang.String expected, java.lang.String actual)
Creates a new TestFailure instance from an assertion failure.static TestFailure
fromTestAssertionFailure(java.lang.Throwable failure, java.lang.String expected, java.lang.String actual, java.util.List<TestFailure> causes)
Creates a new TestFailure instance from an assertion failure.static TestFailure
fromTestFrameworkFailure(java.lang.Throwable failure)
Creates a new TestFailure instance from a test framework failure.static TestFailure
fromTestFrameworkFailure(java.lang.Throwable failure, java.util.List<TestFailure> causes)
Creates a new TestFailure instance from a test framework failure.abstract java.util.List<TestFailure>
getCauses()
Returns the list of causes.abstract TestFailureDetails
getDetails()
Returns structural information about the failure.abstract java.lang.Throwable
getRawFailure()
Returns the raw failure.
-
-
-
Method Detail
-
getCauses
public abstract java.util.List<TestFailure> getCauses()
Returns the list of causes.The result is typically non-empty for multi-assertion failures, e.g. for
org.test4j.MultipleFailuresError
, where the individual failures are in the returned list.- Returns:
- the cause failures.
-
getRawFailure
public abstract java.lang.Throwable getRawFailure()
Returns the raw failure.- Returns:
- the raw failure
-
getDetails
public abstract TestFailureDetails getDetails()
Returns structural information about the failure.- Returns:
- the failure structure
-
fromTestAssertionFailure
public static TestFailure fromTestAssertionFailure(java.lang.Throwable failure, java.lang.String expected, java.lang.String actual)
Creates a new TestFailure instance from an assertion failure.- Parameters:
failure
- the assertion failureexpected
- the expected value for the failure; can benull
actual
- the actual value for the failure; can benull
- Returns:
- the new instance
-
fromTestAssertionFailure
public static TestFailure fromTestAssertionFailure(java.lang.Throwable failure, java.lang.String expected, java.lang.String actual, java.util.List<TestFailure> causes)
Creates a new TestFailure instance from an assertion failure.- Parameters:
failure
- the assertion failureexpected
- the expected value for the failure; can benull
actual
- the actual value for the failure; can benull
causes
- the list of cause failures; can benull
- Returns:
- the new instance
-
fromFileComparisonFailure
public static TestFailure fromFileComparisonFailure(java.lang.Throwable failure, java.lang.String expected, java.lang.String actual, byte[] expectedContent, byte[] actualContent, java.util.List<TestFailure> causes)
Todo- Since:
- 8.3
-
fromTestFrameworkFailure
public static TestFailure fromTestFrameworkFailure(java.lang.Throwable failure)
Creates a new TestFailure instance from a test framework failure.- Parameters:
failure
- the failure- Returns:
- the new instance
-
fromTestFrameworkFailure
public static TestFailure fromTestFrameworkFailure(java.lang.Throwable failure, java.util.List<TestFailure> causes)
Creates a new TestFailure instance from a test framework failure.- Parameters:
failure
- the failurecauses
- the list of cause failures; can benull
- Returns:
- the new instance
-
-