Class TerminationInfo

java.lang.Object
org.junit.platform.testkit.engine.TerminationInfo

@API(status=MAINTAINED, since="1.7") public class TerminationInfo extends Object
TerminationInfo is a union type that allows propagation of terminated container/test state, supporting either the reason if the container/test was skipped or the TestExecutionResult if the container/test was executed.
Since:
1.4
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final boolean
     
    private final String
     
    private final org.junit.platform.engine.TestExecutionResult
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    TerminationInfo(boolean skipped, String skipReason, org.junit.platform.engine.TestExecutionResult testExecutionResult)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Determine if this TerminationInfo represents a completed execution.
    executed(org.junit.platform.engine.TestExecutionResult testExecutionResult)
    Create an executed TerminationInfo instance for the supplied TestExecutionResult.
    org.junit.platform.engine.TestExecutionResult
    Get the TestExecutionResult for the completed execution.
    Get the reason the execution was skipped.
    boolean
    Determine if this TerminationInfo does not represent a skipped execution.
    boolean
    Determine if this TerminationInfo represents a skipped execution.
    skipped(String reason)
    Create a skipped TerminationInfo instance for the supplied reason.
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • skipped

      private final boolean skipped
    • skipReason

      private final String skipReason
    • testExecutionResult

      private final org.junit.platform.engine.TestExecutionResult testExecutionResult
  • Constructor Details

    • TerminationInfo

      private TerminationInfo(boolean skipped, String skipReason, org.junit.platform.engine.TestExecutionResult testExecutionResult)
  • Method Details

    • skipped

      public static TerminationInfo skipped(String reason)
      Create a skipped TerminationInfo instance for the supplied reason.
      Parameters:
      reason - the reason the execution was skipped; may be null
      Returns:
      the created TerminationInfo; never null
      See Also:
    • executed

      public static TerminationInfo executed(org.junit.platform.engine.TestExecutionResult testExecutionResult)
      Create an executed TerminationInfo instance for the supplied TestExecutionResult.
      Parameters:
      testExecutionResult - the result of the execution; never null
      Returns:
      the created TerminationInfo; never null
      See Also:
    • skipped

      public boolean skipped()
      Determine if this TerminationInfo represents a skipped execution.
      Returns:
      true if this this TerminationInfo represents a skipped execution
    • notSkipped

      public boolean notSkipped()
      Determine if this TerminationInfo does not represent a skipped execution.
      Returns:
      true if this this TerminationInfo does not represent a skipped execution
    • executed

      public boolean executed()
      Determine if this TerminationInfo represents a completed execution.
      Returns:
      true if this this TerminationInfo represents a completed execution
    • getSkipReason

      public String getSkipReason() throws UnsupportedOperationException
      Get the reason the execution was skipped.
      Returns:
      the reason the execution was skipped
      Throws:
      UnsupportedOperationException - if this TerminationInfo does not represent a skipped execution
    • getExecutionResult

      public org.junit.platform.engine.TestExecutionResult getExecutionResult() throws UnsupportedOperationException
      Get the TestExecutionResult for the completed execution.
      Returns:
      the result of the completed execution
      Throws:
      UnsupportedOperationException - if this TerminationInfo does not represent a completed execution
    • toString

      public String toString()
      Overrides:
      toString in class Object