Package org.junit.platform.engine
Class TestExecutionResult
- java.lang.Object
-
- org.junit.platform.engine.TestExecutionResult
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TestExecutionResult.Status
Status of executing a single test or container.
-
Field Summary
Fields Modifier and Type Field Description private TestExecutionResult.Status
status
private static TestExecutionResult
SUCCESSFUL_RESULT
private java.lang.Throwable
throwable
-
Constructor Summary
Constructors Modifier Constructor Description private
TestExecutionResult(TestExecutionResult.Status status, java.lang.Throwable throwable)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TestExecutionResult
aborted(java.lang.Throwable throwable)
Create aTestExecutionResult
for an aborted execution of a test or container with the suppliedthrowable
.static TestExecutionResult
failed(java.lang.Throwable throwable)
Create aTestExecutionResult
for a failed execution of a test or container with the suppliedthrowable
.TestExecutionResult.Status
getStatus()
Get the status of this result.java.util.Optional<java.lang.Throwable>
getThrowable()
Get the throwable that caused this result, if available.static TestExecutionResult
successful()
Create aTestExecutionResult
for a successful execution of a test or container.java.lang.String
toString()
-
-
-
Field Detail
-
SUCCESSFUL_RESULT
private static final TestExecutionResult SUCCESSFUL_RESULT
-
status
private final TestExecutionResult.Status status
-
throwable
private final java.lang.Throwable throwable
-
-
Constructor Detail
-
TestExecutionResult
private TestExecutionResult(TestExecutionResult.Status status, java.lang.Throwable throwable)
-
-
Method Detail
-
successful
public static TestExecutionResult successful()
Create aTestExecutionResult
for a successful execution of a test or container.- Returns:
- the
TestExecutionResult
; nevernull
-
aborted
public static TestExecutionResult aborted(java.lang.Throwable throwable)
Create aTestExecutionResult
for an aborted execution of a test or container with the suppliedthrowable
.- Parameters:
throwable
- the throwable that caused the aborted execution; may benull
- Returns:
- the
TestExecutionResult
; nevernull
-
failed
public static TestExecutionResult failed(java.lang.Throwable throwable)
Create aTestExecutionResult
for a failed execution of a test or container with the suppliedthrowable
.- Parameters:
throwable
- the throwable that caused the failed execution; may benull
- Returns:
- the
TestExecutionResult
; nevernull
-
getStatus
public TestExecutionResult.Status getStatus()
Get the status of this result.- Returns:
- the status; never
null
-
getThrowable
public java.util.Optional<java.lang.Throwable> getThrowable()
Get the throwable that caused this result, if available.- Returns:
- an
Optional
containing the throwable; nevernull
but potentially empty
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-