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,ResourceLockAware,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 Modifier and Type Class Description (package private) classClassTemplateTestDescriptor.ClassTemplateExecutor-
Nested classes/interfaces inherited from class org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor
ClassBasedTestDescriptor.ClassInfo
-
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 java.util.List<TestDescriptor>childrenPrototypesprivate java.util.Map<java.lang.Integer,java.util.Collection<? extends TestDescriptor>>childrenPrototypesByIndexprivate ClassBasedTestDescriptordelegateprivate DynamicDescendantFilterdynamicDescendantFilterstatic java.lang.StringNESTED_CLASS_SEGMENT_TYPEstatic java.lang.StringSTANDALONE_CLASS_SEGMENT_TYPE-
Fields inherited from class org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor
classInfo
-
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 Modifier Constructor Description ClassTemplateTestDescriptor(UniqueId uniqueId, ClassBasedTestDescriptor delegate)privateClassTemplateTestDescriptor(UniqueId uniqueId, ClassBasedTestDescriptor delegate, DynamicDescendantFilter dynamicDescendantFilter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanUp(JupiterEngineExecutionContext context)Clean up the suppliedcontextafter execution.protected JupiterTestDescriptorcopyIncludingDescendants(java.util.function.UnaryOperator<UniqueId> uniqueIdTransformer){@return a deep copy (with copies of children) of this descriptor with the supplied unique ID}JupiterEngineExecutionContextexecute(JupiterEngineExecutionContext context, Node.DynamicTestExecutor dynamicTestExecutor)Execute the behavior of this node.DynamicDescendantFiltergetDynamicDescendantFilter()java.util.List<java.lang.Class<?>>getEnclosingTestClasses()java.util.Set<ExclusiveResource>getExclusiveResources()Get the set of exclusive resources required to execute this node.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.org.junit.jupiter.api.extension.TestInstancesinstantiateTestClass(JupiterEngineExecutionContext parentExecutionContext, ExtensionContextSupplier extensionContext, ExtensionRegistry registry, JupiterEngineExecutionContext context)booleanmayRegisterTests()Determine if this descriptor may register dynamic tests during execution.voidprune()Remove this descriptor from the hierarchy unless it is a root or contains tests.protected voidvalidateClassTemplateInvocationLifecycleMethods(DiscoveryIssueReporter reporter)protected voidvalidateCoreLifecycleMethods(DiscoveryIssueReporter reporter)protected ClassTemplateTestDescriptorwithUniqueId(java.util.function.UnaryOperator<UniqueId> uniqueIdTransformer){@return 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, getExecutionModeFromAnnotation, getTags, invokeExecutionExceptionHandlers, 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.jupiter.engine.descriptor.ResourceLockAware
determineExclusiveResources, determineOwnExclusiveResources
-
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 Detail
-
STANDALONE_CLASS_SEGMENT_TYPE
public static final java.lang.String STANDALONE_CLASS_SEGMENT_TYPE
- See Also:
- Constant Field Values
-
NESTED_CLASS_SEGMENT_TYPE
public static final java.lang.String NESTED_CLASS_SEGMENT_TYPE
- See Also:
- Constant Field Values
-
childrenPrototypesByIndex
private final java.util.Map<java.lang.Integer,java.util.Collection<? extends TestDescriptor>> childrenPrototypesByIndex
-
childrenPrototypes
private final java.util.List<TestDescriptor> childrenPrototypes
-
delegate
private final ClassBasedTestDescriptor delegate
-
dynamicDescendantFilter
private final DynamicDescendantFilter dynamicDescendantFilter
-
-
Constructor Detail
-
ClassTemplateTestDescriptor
public ClassTemplateTestDescriptor(UniqueId uniqueId, ClassBasedTestDescriptor delegate)
-
ClassTemplateTestDescriptor
private ClassTemplateTestDescriptor(UniqueId uniqueId, ClassBasedTestDescriptor delegate, DynamicDescendantFilter dynamicDescendantFilter)
-
-
Method Detail
-
getTags
public 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
-
validateCoreLifecycleMethods
protected void validateCoreLifecycleMethods(DiscoveryIssueReporter reporter)
- Overrides:
validateCoreLifecycleMethodsin classClassBasedTestDescriptor
-
validateClassTemplateInvocationLifecycleMethods
protected void validateClassTemplateInvocationLifecycleMethods(DiscoveryIssueReporter reporter)
- Overrides:
validateClassTemplateInvocationLifecycleMethodsin classClassBasedTestDescriptor
-
getDynamicDescendantFilter
public DynamicDescendantFilter getDynamicDescendantFilter()
- Specified by:
getDynamicDescendantFilterin interfaceFilterable
-
copyIncludingDescendants
protected JupiterTestDescriptor copyIncludingDescendants(java.util.function.UnaryOperator<UniqueId> uniqueIdTransformer)
Description copied from class:JupiterTestDescriptor{@return a deep copy (with copies of children) of this descriptor with the supplied unique ID}- Overrides:
copyIncludingDescendantsin classJupiterTestDescriptor
-
withUniqueId
protected ClassTemplateTestDescriptor withUniqueId(java.util.function.UnaryOperator<UniqueId> uniqueIdTransformer)
Description copied from class:JupiterTestDescriptor{@return shallow copy (without children) of this descriptor with the supplied unique ID}- Specified by:
withUniqueIdin classJupiterTestDescriptor
-
prune
public void prune()
Description copied from interface:TestDescriptorRemove this descriptor from the hierarchy unless it is a root or contains tests.A concrete
TestEnginemay override this method in order to implement a different algorithm or to skip pruning altogether.- Specified by:
prunein interfaceTestDescriptor- See Also:
TestDescriptor.isRoot(),TestDescriptor.containsTests(TestDescriptor),TestDescriptor.removeFromHierarchy()
-
mayRegisterTests
public boolean mayRegisterTests()
Description copied from interface:TestDescriptorDetermine 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:
mayRegisterTestsin interfaceTestDescriptor
-
getEnclosingTestClasses
public java.util.List<java.lang.Class<?>> getEnclosingTestClasses()
- Specified by:
getEnclosingTestClassesin interfaceTestClassAware
-
instantiateTestClass
public org.junit.jupiter.api.extension.TestInstances instantiateTestClass(JupiterEngineExecutionContext parentExecutionContext, ExtensionContextSupplier extensionContext, ExtensionRegistry registry, JupiterEngineExecutionContext context)
- Specified by:
instantiateTestClassin classClassBasedTestDescriptor
-
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
-
getExclusiveResources
public java.util.Set<ExclusiveResource> getExclusiveResources()
Description copied from interface:NodeGet the set of exclusive resources required to execute this node.The default implementation returns an empty set.
- Specified by:
getExclusiveResourcesin interfaceNode<JupiterEngineExecutionContext>- Overrides:
getExclusiveResourcesin classJupiterTestDescriptor- Returns:
- the set of exclusive resources required by this node; never
nullbut potentially empty - See Also:
ExclusiveResource
-
cleanUp
public void cleanUp(JupiterEngineExecutionContext context) throws java.lang.Exception
Description copied from interface:NodeClean up the suppliedcontextafter execution.The default implementation does nothing.
- Specified by:
cleanUpin interfaceNode<JupiterEngineExecutionContext>- Overrides:
cleanUpin classClassBasedTestDescriptor- Parameters:
context- the context to execute in- Throws:
java.lang.Exception- See Also:
Node.prepare(EngineExecutionContext)
-
execute
public JupiterEngineExecutionContext execute(JupiterEngineExecutionContext context, Node.DynamicTestExecutor dynamicTestExecutor) throws java.lang.Exception
Description copied from interface:NodeExecute the behavior of this node.Containers typically do not implement this method since the
HierarchicalTestEnginehandles execution of their children.The supplied
dynamicTestExecutormay be used to submit additional dynamic tests for immediate execution.The default implementation returns the supplied
contextunmodified.- Specified by:
executein 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:
java.lang.Exception- See Also:
Node.before(C),Node.after(C)
-
-