Class TerminationInfo
- java.lang.Object
-
- org.junit.platform.testkit.engine.TerminationInfo
-
@API(status=MAINTAINED, since="1.7") public class TerminationInfo extends java.lang.ObjectTerminationInfois a union type that allows propagation of terminated container/test state, supporting either the reason if the container/test was skipped or theTestExecutionResultif the container/test was executed.- Since:
- 1.4
- See Also:
Execution.getTerminationInfo()
-
-
Field Summary
Fields Modifier and Type Field Description private booleanskippedprivate java.lang.StringskipReasonprivate TestExecutionResulttestExecutionResult
-
Constructor Summary
Constructors Modifier Constructor Description privateTerminationInfo(boolean skipped, java.lang.String skipReason, TestExecutionResult testExecutionResult)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanexecuted()Determine if thisTerminationInforepresents a completed execution.static TerminationInfoexecuted(TestExecutionResult testExecutionResult)Create an executedTerminationInfoinstance for the suppliedTestExecutionResult.TestExecutionResultgetExecutionResult()Get theTestExecutionResultfor the completed execution.java.lang.StringgetSkipReason()Get the reason the execution was skipped.booleannotSkipped()Determine if thisTerminationInfodoes not represent a skipped execution.booleanskipped()Determine if thisTerminationInforepresents a skipped execution.static TerminationInfoskipped(java.lang.String reason)Create a skippedTerminationInfoinstance for the supplied reason.java.lang.StringtoString()
-
-
-
Field Detail
-
skipped
private final boolean skipped
-
skipReason
private final java.lang.String skipReason
-
testExecutionResult
private final TestExecutionResult testExecutionResult
-
-
Constructor Detail
-
TerminationInfo
private TerminationInfo(boolean skipped, java.lang.String skipReason, TestExecutionResult testExecutionResult)
-
-
Method Detail
-
skipped
public static TerminationInfo skipped(java.lang.String reason)
Create a skippedTerminationInfoinstance for the supplied reason.- Parameters:
reason- the reason the execution was skipped; may benull- Returns:
- the created
TerminationInfo; nevernull - See Also:
executed(TestExecutionResult)
-
executed
public static TerminationInfo executed(TestExecutionResult testExecutionResult)
Create an executedTerminationInfoinstance for the suppliedTestExecutionResult.- Parameters:
testExecutionResult- the result of the execution; nevernull- Returns:
- the created
TerminationInfo; nevernull - See Also:
skipped(String)
-
skipped
public boolean skipped()
Determine if thisTerminationInforepresents a skipped execution.- Returns:
trueif this thisTerminationInforepresents a skipped execution
-
notSkipped
public boolean notSkipped()
Determine if thisTerminationInfodoes not represent a skipped execution.- Returns:
trueif this thisTerminationInfodoes not represent a skipped execution
-
executed
public boolean executed()
Determine if thisTerminationInforepresents a completed execution.- Returns:
trueif this thisTerminationInforepresents a completed execution
-
getSkipReason
public java.lang.String getSkipReason() throws java.lang.UnsupportedOperationExceptionGet the reason the execution was skipped.- Returns:
- the reason the execution was skipped
- Throws:
java.lang.UnsupportedOperationException- if thisTerminationInfodoes not represent a skipped execution
-
getExecutionResult
public TestExecutionResult getExecutionResult() throws java.lang.UnsupportedOperationException
Get theTestExecutionResultfor the completed execution.- Returns:
- the result of the completed execution
- Throws:
java.lang.UnsupportedOperationException- if thisTerminationInfodoes not represent a completed execution
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-