Class Execution


  • @API(status=MAINTAINED,
         since="1.7")
    public class Execution
    extends java.lang.Object
    Execution encapsulates metadata for the execution of a single TestDescriptor.
    Since:
    1.4
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Execution​(org.junit.platform.engine.TestDescriptor testDescriptor, java.time.Instant startInstant, java.time.Instant endInstant, TerminationInfo terminationInfo)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Execution finished​(org.junit.platform.engine.TestDescriptor testDescriptor, java.time.Instant startInstant, java.time.Instant endInstant, org.junit.platform.engine.TestExecutionResult executionResult)
      Create a new instance of an Execution that finished with the provided TestExecutionResult.
      java.time.Duration getDuration()
      Get the Duration of this Execution.
      java.time.Instant getEndInstant()
      Get the end Instant of this Execution.
      java.time.Instant getStartInstant()
      Get the start Instant of this Execution.
      TerminationInfo getTerminationInfo()
      Get the TerminationInfo for this Execution.
      org.junit.platform.engine.TestDescriptor getTestDescriptor()
      Get the TestDescriptor for this Execution.
      static Execution skipped​(org.junit.platform.engine.TestDescriptor testDescriptor, java.time.Instant startInstant, java.time.Instant endInstant, java.lang.String skipReason)
      Create a new instance of an Execution that was skipped with the provided skipReason.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • testDescriptor

        private final org.junit.platform.engine.TestDescriptor testDescriptor
      • startInstant

        private final java.time.Instant startInstant
      • endInstant

        private final java.time.Instant endInstant
      • duration

        private final java.time.Duration duration
    • Constructor Detail

      • Execution

        private Execution​(org.junit.platform.engine.TestDescriptor testDescriptor,
                          java.time.Instant startInstant,
                          java.time.Instant endInstant,
                          TerminationInfo terminationInfo)
    • Method Detail

      • finished

        public static Execution finished​(org.junit.platform.engine.TestDescriptor testDescriptor,
                                         java.time.Instant startInstant,
                                         java.time.Instant endInstant,
                                         org.junit.platform.engine.TestExecutionResult executionResult)
        Create a new instance of an Execution that finished with the provided TestExecutionResult.
        Parameters:
        testDescriptor - the TestDescriptor that finished; never null
        startInstant - the Instant that the Execution started; never null
        endInstant - the Instant that the Execution completed; never null
        executionResult - the TestExecutionResult of the finished TestDescriptor; never null
        Returns:
        the newly created Execution instance; never null
      • skipped

        public static Execution skipped​(org.junit.platform.engine.TestDescriptor testDescriptor,
                                        java.time.Instant startInstant,
                                        java.time.Instant endInstant,
                                        java.lang.String skipReason)
        Create a new instance of an Execution that was skipped with the provided skipReason.
        Parameters:
        testDescriptor - the TestDescriptor that finished; never null
        startInstant - the Instant that the Execution started; never null
        endInstant - the Instant that the Execution completed; never null
        skipReason - the reason the TestDescriptor was skipped; may be null
        Returns:
        the newly created Execution instance; never null
      • getTestDescriptor

        public org.junit.platform.engine.TestDescriptor getTestDescriptor()
        Get the TestDescriptor for this Execution.
        Returns:
        the TestDescriptor for this Execution
      • getStartInstant

        public java.time.Instant getStartInstant()
        Get the start Instant of this Execution.
        Returns:
        the start Instant of this Execution
      • getEndInstant

        public java.time.Instant getEndInstant()
        Get the end Instant of this Execution.
        Returns:
        the end Instant of this Execution
      • getDuration

        public java.time.Duration getDuration()
        Get the Duration of this Execution.
        Returns:
        the Duration of this Execution
      • getTerminationInfo

        public TerminationInfo getTerminationInfo()
        Get the TerminationInfo for this Execution.
        Returns:
        the TerminationInfo for this Execution
      • toString

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