Class MethodBasedTestDescriptor
- java.lang.Object
-
- org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
-
- org.junit.jupiter.engine.descriptor.JupiterTestDescriptor
-
- org.junit.jupiter.engine.descriptor.MethodBasedTestDescriptor
-
- All Implemented Interfaces:
ResourceLockAware,TestClassAware,Validatable,Node<JupiterEngineExecutionContext>,TestDescriptor
- Direct Known Subclasses:
TestMethodTestDescriptor,TestTemplateTestDescriptor
@API(status=INTERNAL, since="5.0") public abstract class MethodBasedTestDescriptor extends JupiterTestDescriptor implements ResourceLockAware, TestClassAware, ValidatableBase class forTestDescriptorsbased on Java methods.- Since:
- 5.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classMethodBasedTestDescriptor.MethodInfo-
Nested classes/interfaces inherited from class org.junit.jupiter.engine.descriptor.JupiterTestDescriptor
JupiterTestDescriptor.ExceptionHandlerInvoker<E extends org.junit.jupiter.api.extension.Extension>
-
Nested classes/interfaces inherited from interface org.junit.platform.engine.support.hierarchical.Node
Node.DynamicTestExecutor, Node.ExecutionMode, Node.Invocation<C extends EngineExecutionContext>, Node.SkipResult
-
Nested classes/interfaces inherited from interface org.junit.platform.engine.TestDescriptor
TestDescriptor.Type, TestDescriptor.Visitor
-
-
Field Summary
Fields Modifier and Type Field Description private static org.junit.platform.commons.logging.Loggerloggerprivate MethodBasedTestDescriptor.MethodInfomethodInfo-
Fields inherited from class org.junit.jupiter.engine.descriptor.JupiterTestDescriptor
configuration
-
Fields inherited from class org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
children
-
-
Constructor Summary
Constructors Constructor Description MethodBasedTestDescriptor(UniqueId uniqueId, java.lang.Class<?> testClass, java.lang.reflect.Method testMethod, java.util.function.Supplier<java.util.List<java.lang.Class<?>>> enclosingInstanceTypes, JupiterConfiguration configuration)MethodBasedTestDescriptor(UniqueId uniqueId, java.lang.String displayName, java.lang.Class<?> testClass, java.lang.reflect.Method testMethod, JupiterConfiguration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.Class<?>>getEnclosingTestClasses()ExclusiveResourceCollectorgetExclusiveResourceCollector()protected java.util.Optional<Node.ExecutionMode>getExplicitExecutionMode()java.lang.StringgetLegacyReportingName()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.java.util.function.Function<org.junit.jupiter.api.parallel.ResourceLocksProvider,java.util.Set<org.junit.jupiter.api.parallel.ResourceLocksProvider.Lock>>getResourceLocksProviderEvaluator()java.util.Set<TestTag>getTags()Get the set of tags associated with this descriptor.java.lang.Class<?>getTestClass()java.lang.reflect.MethodgetTestMethod()protected voidinvokeTestWatchers(JupiterEngineExecutionContext context, boolean reverseOrder, java.util.function.Consumer<org.junit.jupiter.api.extension.TestWatcher> callback)voidnodeSkipped(JupiterEngineExecutionContext context, TestDescriptor descriptor, Node.SkipResult result)InvokeTestWatcher.testDisabled(ExtensionContext, Optional)on each registeredTestWatcher, in registration order.voidvalidate(DiscoveryIssueReporter reporter)Validate the state of this descriptor and report any issues found to the suppliedDiscoveryIssueReporter.-
Methods inherited from class org.junit.jupiter.engine.descriptor.JupiterTestDescriptor
cleanUp, copyIncludingDescendants, getDefaultChildExecutionMode, getExclusiveResources, getExecutionMode, getExecutionModeFromAnnotation, getTags, invokeExecutionExceptionHandlers, prepare, shouldBeSkipped, toExecutionMode, withUniqueId
-
Methods inherited from class org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
addChild, equals, findByUniqueId, getChildren, getDisplayName, getParent, getSource, getUniqueId, hashCode, orderChildren, removeChild, removeFromHierarchy, setParent, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.junit.platform.engine.support.hierarchical.Node
after, around, before, execute, nodeFinished
-
Methods inherited from interface org.junit.jupiter.engine.descriptor.ResourceLockAware
determineExclusiveResources, determineOwnExclusiveResources
-
Methods inherited from interface org.junit.platform.engine.TestDescriptor
accept, addChild, findByUniqueId, getAncestors, getChildren, getDescendants, getDisplayName, getParent, getSource, getType, getUniqueId, isContainer, isRoot, isTest, mayRegisterTests, orderChildren, prune, removeChild, removeFromHierarchy, setParent
-
-
-
-
Field Detail
-
logger
private static final org.junit.platform.commons.logging.Logger logger
-
methodInfo
private final MethodBasedTestDescriptor.MethodInfo methodInfo
-
-
Constructor Detail
-
MethodBasedTestDescriptor
MethodBasedTestDescriptor(UniqueId uniqueId, java.lang.Class<?> testClass, java.lang.reflect.Method testMethod, java.util.function.Supplier<java.util.List<java.lang.Class<?>>> enclosingInstanceTypes, JupiterConfiguration configuration)
-
MethodBasedTestDescriptor
MethodBasedTestDescriptor(UniqueId uniqueId, java.lang.String displayName, java.lang.Class<?> testClass, java.lang.reflect.Method testMethod, JupiterConfiguration configuration)
-
-
Method Detail
-
getTestMethod
public final java.lang.reflect.Method getTestMethod()
-
getTags
public final java.util.Set<TestTag> getTags()
Description copied from interface:TestDescriptorGet the set of tags associated with this descriptor.- Specified by:
getTagsin interfaceTestDescriptor- Overrides:
getTagsin classAbstractTestDescriptor- Returns:
- the set of tags associated with this descriptor; never
nullbut potentially empty - See Also:
TestTag
-
getLegacyReportingName
public java.lang.String getLegacyReportingName()
Description copied from interface:TestDescriptorGet 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().- Specified by:
getLegacyReportingNamein interfaceTestDescriptor- Returns:
- the legacy reporting name; never
nullor blank
-
getTestClass
public final java.lang.Class<?> getTestClass()
- Specified by:
getTestClassin interfaceTestClassAware
-
getEnclosingTestClasses
public java.util.List<java.lang.Class<?>> getEnclosingTestClasses()
- Specified by:
getEnclosingTestClassesin interfaceTestClassAware
-
validate
public void validate(DiscoveryIssueReporter reporter)
Description copied from interface:ValidatableValidate the state of this descriptor and report any issues found to the suppliedDiscoveryIssueReporter.- Specified by:
validatein interfaceValidatable
-
getExclusiveResourceCollector
public ExclusiveResourceCollector getExclusiveResourceCollector()
- Specified by:
getExclusiveResourceCollectorin interfaceResourceLockAware
-
getResourceLocksProviderEvaluator
public java.util.function.Function<org.junit.jupiter.api.parallel.ResourceLocksProvider,java.util.Set<org.junit.jupiter.api.parallel.ResourceLocksProvider.Lock>> getResourceLocksProviderEvaluator()
- Specified by:
getResourceLocksProviderEvaluatorin interfaceResourceLockAware
-
getExplicitExecutionMode
protected java.util.Optional<Node.ExecutionMode> getExplicitExecutionMode()
- Overrides:
getExplicitExecutionModein classJupiterTestDescriptor
-
nodeSkipped
public void nodeSkipped(JupiterEngineExecutionContext context, TestDescriptor descriptor, Node.SkipResult result)
InvokeTestWatcher.testDisabled(ExtensionContext, Optional)on each registeredTestWatcher, in registration order.- Specified by:
nodeSkippedin interfaceNode<JupiterEngineExecutionContext>- Parameters:
context- the execution contextdescriptor- the test descriptor that was skippedresult- the result of skipped execution- Since:
- 5.4
-
invokeTestWatchers
protected void invokeTestWatchers(JupiterEngineExecutionContext context, boolean reverseOrder, java.util.function.Consumer<org.junit.jupiter.api.extension.TestWatcher> callback)
- Since:
- 5.4
-
-