Class TestTemplateTestDescriptor
- java.lang.Object
-
- org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
-
- org.junit.jupiter.engine.descriptor.JupiterTestDescriptor
-
- org.junit.jupiter.engine.descriptor.MethodBasedTestDescriptor
-
- org.junit.jupiter.engine.descriptor.TestTemplateTestDescriptor
-
- All Implemented Interfaces:
Filterable,ResourceLockAware,TestClassAware,Validatable,Node<JupiterEngineExecutionContext>,TestDescriptor
@API(status=INTERNAL, since="5.0") public class TestTemplateTestDescriptor extends MethodBasedTestDescriptor implements FilterableTestDescriptorfor@TestTemplatemethods.- Since:
- 5.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classTestTemplateTestDescriptor.TestTemplateExecutor-
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 DynamicDescendantFilterdynamicDescendantFilterstatic java.lang.StringSEGMENT_TYPE-
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 TestTemplateTestDescriptor(UniqueId uniqueId, java.lang.Class<?> testClass, java.lang.reflect.Method templateMethod, java.util.function.Supplier<java.util.List<java.lang.Class<?>>> enclosingInstanceTypes, JupiterConfiguration configuration)privateTestTemplateTestDescriptor(UniqueId uniqueId, java.lang.String displayName, java.lang.Class<?> testClass, java.lang.reflect.Method templateMethod, JupiterConfiguration configuration, DynamicDescendantFilter dynamicDescendantFilter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JupiterEngineExecutionContextexecute(JupiterEngineExecutionContext context, Node.DynamicTestExecutor dynamicTestExecutor)Execute the behavior of this node.DynamicDescendantFiltergetDynamicDescendantFilter()TestDescriptor.TypegetType()Determine theTestDescriptor.Typeof this descriptor.booleanmayRegisterTests()Determine if this descriptor may register dynamic tests during execution.JupiterEngineExecutionContextprepare(JupiterEngineExecutionContext context)Must be overridden and return a new context with a newExtensionContextso cleanUp() does not accidentally close the parent context.protected TestTemplateTestDescriptorwithUniqueId(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.MethodBasedTestDescriptor
getEnclosingTestClasses, getExclusiveResourceCollector, getExplicitExecutionMode, getLegacyReportingName, getResourceLocksProviderEvaluator, getTags, getTestClass, getTestMethod, invokeTestWatchers, nodeSkipped, validate
-
Methods inherited from class org.junit.jupiter.engine.descriptor.JupiterTestDescriptor
cleanUp, copyIncludingDescendants, getDefaultChildExecutionMode, getExclusiveResources, 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
after, around, before, 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, getUniqueId, isContainer, isRoot, isTest, orderChildren, prune, removeChild, removeFromHierarchy, setParent
-
-
-
-
Field Detail
-
SEGMENT_TYPE
public static final java.lang.String SEGMENT_TYPE
- See Also:
- Constant Field Values
-
dynamicDescendantFilter
private final DynamicDescendantFilter dynamicDescendantFilter
-
-
Constructor Detail
-
TestTemplateTestDescriptor
public TestTemplateTestDescriptor(UniqueId uniqueId, java.lang.Class<?> testClass, java.lang.reflect.Method templateMethod, java.util.function.Supplier<java.util.List<java.lang.Class<?>>> enclosingInstanceTypes, JupiterConfiguration configuration)
-
TestTemplateTestDescriptor
private TestTemplateTestDescriptor(UniqueId uniqueId, java.lang.String displayName, java.lang.Class<?> testClass, java.lang.reflect.Method templateMethod, JupiterConfiguration configuration, DynamicDescendantFilter dynamicDescendantFilter)
-
-
Method Detail
-
withUniqueId
protected TestTemplateTestDescriptor 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
-
getDynamicDescendantFilter
public DynamicDescendantFilter getDynamicDescendantFilter()
- Specified by:
getDynamicDescendantFilterin interfaceFilterable
-
getType
public TestDescriptor.Type getType()
Description copied from interface:TestDescriptorDetermine theTestDescriptor.Typeof this descriptor.- Specified by:
getTypein interfaceTestDescriptor- Returns:
- the descriptor type; never
null. - See Also:
TestDescriptor.isContainer(),TestDescriptor.isTest()
-
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
-
prepare
public JupiterEngineExecutionContext prepare(JupiterEngineExecutionContext context)
Description copied from class:JupiterTestDescriptorMust be overridden and return a new context with a newExtensionContextso cleanUp() does not accidentally close the parent context.- Specified by:
preparein interfaceNode<JupiterEngineExecutionContext>- Specified by:
preparein classJupiterTestDescriptor- See Also:
Node.cleanUp(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)
-
-