Class TerminationInfo


  • @API(status=EXPERIMENTAL,
         since="1.4")
    public class TerminationInfo
    extends java.lang.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:
    Execution.getTerminationInfo()
    • Field Detail

      • skipped

        private final boolean skipped
      • skipReason

        private final java.lang.String skipReason
    • 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 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(TestExecutionResult)
      • 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 java.lang.String getSkipReason()
                                       throws java.lang.UnsupportedOperationException
        Get the reason the execution was skipped.
        Returns:
        the reason the execution was skipped
        Throws:
        java.lang.UnsupportedOperationException - if this TerminationInfo does not represent a skipped execution
      • getExecutionResult

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object