Class MethodBasedTestDescriptor

All Implemented Interfaces:
Node<JupiterEngineExecutionContext>, TestDescriptor
Direct Known Subclasses:
TestMethodTestDescriptor, TestTemplateTestDescriptor

@API(status=INTERNAL, since="5.0") public abstract class MethodBasedTestDescriptor extends JupiterTestDescriptor
Base class for TestDescriptors based on Java methods.
Since:
5.0
  • Field Details

    • logger

      private static final org.junit.platform.commons.logging.Logger logger
    • testClass

      private final Class<?> testClass
    • testMethod

      private final Method testMethod
    • tags

      private final Set<TestTag> tags
      Set of method-level tags; does not contain tags from parent.
  • Constructor Details

  • Method Details

    • getTags

      public final Set<TestTag> getTags()
      Description copied from interface: TestDescriptor
      Get the set of tags associated with this descriptor.
      Specified by:
      getTags in interface TestDescriptor
      Overrides:
      getTags in class AbstractTestDescriptor
      Returns:
      the set of tags associated with this descriptor; never null but potentially empty
      See Also:
    • getExclusiveResources

      public Set<ExclusiveResource> getExclusiveResources()
      Description copied from interface: Node
      Get the set of exclusive resources required to execute this node.

      The default implementation returns an empty set.

      Returns:
      the set of exclusive resources required by this node; never null but potentially empty
      See Also:
    • getExplicitExecutionMode

      protected Optional<Node.ExecutionMode> getExplicitExecutionMode()
      Overrides:
      getExplicitExecutionMode in class JupiterTestDescriptor
    • getTestClass

      public final Class<?> getTestClass()
    • getTestMethod

      public final Method getTestMethod()
    • getLegacyReportingName

      public String getLegacyReportingName()
      Description copied from interface: TestDescriptor
      Get the name of this descriptor in a format that is suitable for legacy reporting infrastructure — for example, for reporting systems built on the Ant-based XML reporting format for JUnit 4.

      The default implementation delegates to TestDescriptor.getDisplayName().

      Returns:
      the legacy reporting name; never null or blank
    • nodeSkipped

      public void nodeSkipped(JupiterEngineExecutionContext context, TestDescriptor descriptor, Node.SkipResult result)
      Invoke TestWatcher.testDisabled(ExtensionContext, Optional) on each registered TestWatcher, in registration order.
      Parameters:
      context - the execution context
      descriptor - the test descriptor that was skipped
      result - the result of skipped execution
      Since:
      5.4
    • invokeTestWatchers

      protected void invokeTestWatchers(JupiterEngineExecutionContext context, boolean reverseOrder, Consumer<org.junit.jupiter.api.extension.TestWatcher> callback)
      Since:
      5.4