Module org.junit.jupiter.engine
Class ClassTemplateTestDescriptor
java.lang.Object
org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
org.junit.jupiter.engine.descriptor.JupiterTestDescriptor
org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor
org.junit.jupiter.engine.descriptor.ClassTemplateTestDescriptor
- All Implemented Interfaces:
Filterable
,TestClassAware
,Validatable
,Node<JupiterEngineExecutionContext>
,TestDescriptor
@API(status=INTERNAL,
since="5.13")
public class ClassTemplateTestDescriptor
extends ClassBasedTestDescriptor
implements Filterable
- Since:
- 5.13
-
Nested Class Summary
Nested classes/interfaces inherited from class org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor
ClassBasedTestDescriptor.ClassInfo
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
FieldsFields inherited from class org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor
classInfo
Fields inherited from class org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
children
-
Constructor Summary
ConstructorsConstructorDescriptionClassTemplateTestDescriptor
(UniqueId uniqueId, ClassBasedTestDescriptor delegate) -
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanUp
(JupiterEngineExecutionContext context) Clean up the suppliedcontext
after execution.protected JupiterTestDescriptor
copyIncludingDescendants
(UnaryOperator<UniqueId> uniqueIdTransformer) Returns a deep copy (with copies of children) of this descriptor with the supplied unique ID.default Stream
<ExclusiveResource> default Stream
<ExclusiveResource> determineOwnExclusiveResources
(Function<ResourceLocksProvider, Set<ResourceLocksProvider.Lock>> providerToLocks) execute
(JupiterEngineExecutionContext context, Node.DynamicTestExecutor dynamicTestExecutor) Execute the behavior of this node.Get the set of exclusive resources required to execute this node.getTags()
Get the set of tags associated with this descriptor.instantiateTestClass
(JupiterEngineExecutionContext parentExecutionContext, ExtensionContextSupplier extensionContext, ExtensionRegistry registry, JupiterEngineExecutionContext context) boolean
Determine if this descriptor may register dynamic tests during execution.void
prune()
Remove this descriptor from the hierarchy unless it is a root or contains tests.protected void
protected void
protected ClassTemplateTestDescriptor
withUniqueId
(UnaryOperator<UniqueId> uniqueIdTransformer) Returns shallow copy (without children) of this descriptor with the supplied unique ID.Methods inherited from class org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor
after, before, getDefaultChildExecutionMode, getExclusiveResourceCollector, getExplicitExecutionMode, getLegacyReportingName, getTestClass, getType, instantiateTestClass, prepare, setDefaultChildExecutionMode, validate
Methods inherited from class org.junit.jupiter.engine.descriptor.JupiterTestDescriptor
getExecutionMode, shouldBeSkipped, toExecutionMode
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
around, nodeFinished, nodeSkipped
Methods inherited from interface org.junit.platform.engine.TestDescriptor
accept, addChild, findByUniqueId, getAncestors, getChildren, getDescendants, getDisplayName, getParent, getSource, getUniqueId, isContainer, isRoot, isTest, orderChildren, removeChild, removeFromHierarchy, setParent
-
Field Details
-
STANDALONE_CLASS_SEGMENT_TYPE
- See Also:
-
NESTED_CLASS_SEGMENT_TYPE
- See Also:
-
-
Constructor Details
-
ClassTemplateTestDescriptor
-
-
Method Details
-
getTags
Description copied from interface:TestDescriptor
Get the set of tags associated with this descriptor.- Specified by:
getTags
in interfaceTestDescriptor
- Overrides:
getTags
in classAbstractTestDescriptor
- Returns:
- the set of tags associated with this descriptor; never
null
but potentially empty - See Also:
-
validateCoreLifecycleMethods
- Overrides:
validateCoreLifecycleMethods
in classClassBasedTestDescriptor
-
validateClassTemplateInvocationLifecycleMethods
- Overrides:
validateClassTemplateInvocationLifecycleMethods
in classClassBasedTestDescriptor
-
getDynamicDescendantFilter
- Specified by:
getDynamicDescendantFilter
in interfaceFilterable
-
copyIncludingDescendants
protected JupiterTestDescriptor copyIncludingDescendants(UnaryOperator<UniqueId> uniqueIdTransformer) Description copied from class:JupiterTestDescriptor
Returns a deep copy (with copies of children) of this descriptor with the supplied unique ID.- Overrides:
copyIncludingDescendants
in classJupiterTestDescriptor
- Returns:
- a deep copy (with copies of children) of this descriptor with the supplied unique ID
-
withUniqueId
Description copied from class:JupiterTestDescriptor
Returns shallow copy (without children) of this descriptor with the supplied unique ID.- Specified by:
withUniqueId
in classJupiterTestDescriptor
- Returns:
- shallow copy (without children) of this descriptor with the supplied unique ID
-
prune
public void prune()Description copied from interface:TestDescriptor
Remove this descriptor from the hierarchy unless it is a root or contains tests.A concrete
TestEngine
may override this method in order to implement a different algorithm or to skip pruning altogether.- Specified by:
prune
in interfaceTestDescriptor
- See Also:
-
mayRegisterTests
public boolean mayRegisterTests()Description copied from interface:TestDescriptor
Determine if this descriptor may register dynamic tests during execution.The default implementation assumes tests are usually known during discovery and thus returns
false
.- Specified by:
mayRegisterTests
in interfaceTestDescriptor
-
getEnclosingTestClasses
- Specified by:
getEnclosingTestClasses
in interfaceTestClassAware
-
instantiateTestClass
public TestInstances instantiateTestClass(JupiterEngineExecutionContext parentExecutionContext, ExtensionContextSupplier extensionContext, ExtensionRegistry registry, JupiterEngineExecutionContext context) - Specified by:
instantiateTestClass
in classClassBasedTestDescriptor
-
getResourceLocksProviderEvaluator
public Function<ResourceLocksProvider,Set<ResourceLocksProvider.Lock>> getResourceLocksProviderEvaluator() -
getExclusiveResources
Description copied from interface:Node
Get the set of exclusive resources required to execute this node.The default implementation returns an empty set.
- Specified by:
getExclusiveResources
in interfaceNode<JupiterEngineExecutionContext>
- Overrides:
getExclusiveResources
in classJupiterTestDescriptor
- Returns:
- the set of exclusive resources required by this node; never
null
but potentially empty - See Also:
-
cleanUp
Description copied from interface:Node
Clean up the suppliedcontext
after execution.The default implementation does nothing.
- Specified by:
cleanUp
in interfaceNode<JupiterEngineExecutionContext>
- Overrides:
cleanUp
in classClassBasedTestDescriptor
- Parameters:
context
- the context to execute in- Throws:
Exception
- See Also:
-
execute
public JupiterEngineExecutionContext execute(JupiterEngineExecutionContext context, Node.DynamicTestExecutor dynamicTestExecutor) throws Exception Description copied from interface:Node
Execute the behavior of this node.Containers typically do not implement this method since the
HierarchicalTestEngine
handles execution of their children.The supplied
dynamicTestExecutor
may be used to submit additional dynamic tests for immediate execution.The default implementation returns the supplied
context
unmodified.- Specified by:
execute
in interfaceNode<JupiterEngineExecutionContext>
- Parameters:
context
- the context to execute indynamicTestExecutor
- the executor to submit dynamic tests to- Returns:
- the new context to be used for children of this node and for the after behavior of the parent of this node, if any
- Throws:
Exception
- See Also:
-
determineExclusiveResources
-
determineOwnExclusiveResources
default Stream<ExclusiveResource> determineOwnExclusiveResources(Function<ResourceLocksProvider, Set<ResourceLocksProvider.Lock>> providerToLocks)
-