Class JupiterTestDescriptor
java.lang.Object
org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
org.junit.jupiter.engine.descriptor.JupiterTestDescriptor
- All Implemented Interfaces:
Node<JupiterEngineExecutionContext>, TestDescriptor
- Direct Known Subclasses:
ClassBasedTestDescriptor, ClassTemplateInvocationTestDescriptor, DynamicNodeTestDescriptor, MethodBasedTestDescriptor
@API(status=INTERNAL,
since="5.0")
public abstract class JupiterTestDescriptor
extends AbstractTestDescriptor
implements Node<JupiterEngineExecutionContext>
- Since:
- 5.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static interfaceJupiterTestDescriptor.ExceptionHandlerInvoker<E extends org.junit.jupiter.api.extension.Extension>Nested classes/interfaces inherited from interface Node
Node.DynamicTestExecutor, Node.ExecutionMode, Node.Invocation<C>, Node.SkipResultNested classes/interfaces inherited from interface TestDescriptor
TestDescriptor.Type, TestDescriptor.Visitor -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ConditionEvaluator(package private) final JupiterConfigurationFields inherited from class AbstractTestDescriptor
children -
Constructor Summary
ConstructorsConstructorDescriptionJupiterTestDescriptor(UniqueId uniqueId, AnnotatedElement element, Supplier<String> displayNameSupplier, TestSource source, JupiterConfiguration configuration) JupiterTestDescriptor(UniqueId uniqueId, String displayName, TestSource source, JupiterConfiguration configuration) -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanUp(JupiterEngineExecutionContext context) Clean up the suppliedcontextafter execution.protected JupiterTestDescriptorcopyIncludingDescendants(UnaryOperator<UniqueId> uniqueIdTransformer) Returns a deep copy (with copies of children) of this descriptor with the supplied unique ID.(package private) Optional<Node.ExecutionMode> Get the set of exclusive resources required to execute this node.Get the preferred of execution mode for parallel execution of this node.(package private) Optional<Node.ExecutionMode> (package private) Optional<Node.ExecutionMode> getTags(AnnotatedElement element, Supplier<String> elementDescription, Supplier<TestSource> sourceProvider, Consumer<DiscoveryIssue> issueCollector) (package private) <E extends org.junit.jupiter.api.extension.Extension>
voidinvokeExecutionExceptionHandlers(Class<E> handlerType, ExtensionRegistry registry, Throwable throwable, JupiterTestDescriptor.ExceptionHandlerInvoker<E> handlerInvoker) Invoke exception handlers for the suppliedThrowableone-by-one until none are left or the throwable to handle has been swallowed.private <E extends org.junit.jupiter.api.extension.Extension>
voidinvokeExecutionExceptionHandlers(List<E> exceptionHandlers, Throwable throwable, JupiterTestDescriptor.ExceptionHandlerInvoker<E> handlerInvoker) abstract JupiterEngineExecutionContextprepare(JupiterEngineExecutionContext context) Must be overridden and return a new context with a newExtensionContextso cleanUp() does not accidentally close the parent context.Determine if the execution of the suppliedcontextshould be skipped.static Node.ExecutionModetoExecutionMode(org.junit.jupiter.api.parallel.ExecutionMode mode) private Node.SkipResulttoSkipResult(org.junit.jupiter.api.extension.ConditionEvaluationResult evaluationResult) protected abstract JupiterTestDescriptorwithUniqueId(UnaryOperator<UniqueId> uniqueIdTransformer) Returns shallow copy (without children) of this descriptor with the supplied unique ID.Methods inherited from class AbstractTestDescriptor
addChild, equals, findByUniqueId, getChildren, getDisplayName, getParent, getSource, getTags, getUniqueId, hashCode, orderChildren, removeChild, removeFromHierarchy, setParent, toStringMethods inherited from interface Node
after, around, before, execute, nodeFinished, nodeSkippedMethods inherited from interface TestDescriptor
accept, getAncestors, getDescendants, getLegacyReportingName, getType, isContainer, isRoot, isTest, mayRegisterTests, prune
-
Field Details
-
conditionEvaluator
-
configuration
-
-
Constructor Details
-
JupiterTestDescriptor
JupiterTestDescriptor(UniqueId uniqueId, AnnotatedElement element, Supplier<String> displayNameSupplier, TestSource source, JupiterConfiguration configuration) -
JupiterTestDescriptor
JupiterTestDescriptor(UniqueId uniqueId, String displayName, TestSource source, JupiterConfiguration configuration)
-
-
Method Details
-
getTags
static Set<TestTag> getTags(AnnotatedElement element, Supplier<String> elementDescription, Supplier<TestSource> sourceProvider, Consumer<DiscoveryIssue> issueCollector) -
invokeExecutionExceptionHandlers
<E extends org.junit.jupiter.api.extension.Extension> void invokeExecutionExceptionHandlers(Class<E> handlerType, ExtensionRegistry registry, Throwable throwable, JupiterTestDescriptor.ExceptionHandlerInvoker<E> handlerInvoker) Invoke exception handlers for the suppliedThrowableone-by-one until none are left or the throwable to handle has been swallowed. -
invokeExecutionExceptionHandlers
private <E extends org.junit.jupiter.api.extension.Extension> void invokeExecutionExceptionHandlers(List<E> exceptionHandlers, Throwable throwable, JupiterTestDescriptor.ExceptionHandlerInvoker<E> handlerInvoker) -
getExecutionMode
Description copied from interface:NodeGet the preferred of execution mode for parallel execution of this node.The default implementation returns
Node.ExecutionMode.CONCURRENT.- Specified by:
getExecutionModein interfaceNode<JupiterEngineExecutionContext>- Returns:
- the preferred execution mode of this node; never
null - See Also:
-
getExplicitExecutionMode
Optional<Node.ExecutionMode> getExplicitExecutionMode() -
getDefaultChildExecutionMode
Optional<Node.ExecutionMode> getDefaultChildExecutionMode() -
getExecutionModeFromAnnotation
-
toExecutionMode
-
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>- Returns:
- the set of exclusive resources required by this node; never
nullbut potentially empty - See Also:
-
shouldBeSkipped
Description copied from interface:NodeDetermine if the execution of the suppliedcontextshould be skipped.The default implementation returns
Node.SkipResult.doNotSkip().- Specified by:
shouldBeSkippedin interfaceNode<JupiterEngineExecutionContext>
-
toSkipResult
private Node.SkipResult toSkipResult(org.junit.jupiter.api.extension.ConditionEvaluationResult evaluationResult) -
prepare
public abstract JupiterEngineExecutionContext prepare(JupiterEngineExecutionContext context) throws Exception Must be overridden and return a new context with a newExtensionContextso cleanUp() does not accidentally close the parent context.- Specified by:
preparein interfaceNode<JupiterEngineExecutionContext>- Throws:
Exception- See Also:
-
cleanUp
Description copied from interface:NodeClean up the suppliedcontextafter execution.The default implementation does nothing.
- Specified by:
cleanUpin interfaceNode<JupiterEngineExecutionContext>- Parameters:
context- the context to execute in- Throws:
Exception- See Also:
-
copyIncludingDescendants
protected JupiterTestDescriptor copyIncludingDescendants(UnaryOperator<UniqueId> uniqueIdTransformer) Returns a deep copy (with copies of children) of this descriptor with the supplied unique ID.- Returns:
- a deep copy (with copies of children) of this descriptor with the supplied unique ID
-
withUniqueId
Returns shallow copy (without children) of this descriptor with the supplied unique ID.- Returns:
- shallow copy (without children) of this descriptor with the supplied unique ID
-