Package org.junit.platform.engine
Class TestExecutionResult
java.lang.Object
org.junit.platform.engine.TestExecutionResult
@API(status=STABLE,
since="1.0")
public class TestExecutionResult
extends java.lang.Object
TestExecutionResult encapsulates the result of executing a single test
or container.
A TestExecutionResult consists of a mandatory
Status and an optional Throwable.
- Since:
- 1.0
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTestExecutionResult.StatusStatus of executing a single test or container. -
Method Summary
Modifier and Type Method Description static TestExecutionResultaborted(java.lang.Throwable throwable)Create aTestExecutionResultfor an aborted execution of a test or container with the suppliedthrowable.static TestExecutionResultfailed(java.lang.Throwable throwable)Create aTestExecutionResultfor a failed execution of a test or container with the suppliedthrowable.TestExecutionResult.StatusgetStatus()Get the status of this result.java.util.Optional<java.lang.Throwable>getThrowable()Get the throwable that caused this result, if available.static TestExecutionResultsuccessful()Create aTestExecutionResultfor a successful execution of a test or container.java.lang.StringtoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Method Details
-
successful
Create aTestExecutionResultfor a successful execution of a test or container.- Returns:
- the
TestExecutionResult; nevernull
-
aborted
Create aTestExecutionResultfor 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
Create aTestExecutionResultfor 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
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
Optionalcontaining the throwable; nevernullbut potentially empty
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-