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 Classes Modifier and Type Class Description (package private) static interfaceJupiterTestDescriptor.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 ConditionEvaluatorconditionEvaluator(package private) JupiterConfigurationconfiguration-
Fields inherited from class org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
children
-
-
Constructor Summary
Constructors Constructor Description JupiterTestDescriptor(UniqueId uniqueId, java.lang.reflect.AnnotatedElement element, java.util.function.Supplier<java.lang.String> displayNameSupplier, TestSource source, JupiterConfiguration configuration)JupiterTestDescriptor(UniqueId uniqueId, java.lang.String displayName, TestSource source, JupiterConfiguration configuration)
-
Method Summary
All Methods Static Methods Instance Methods Abstract 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}(package private) java.util.Optional<Node.ExecutionMode>getDefaultChildExecutionMode()java.util.Set<ExclusiveResource>getExclusiveResources()Get the set of exclusive resources required to execute this node.Node.ExecutionModegetExecutionMode()Get the preferred of execution mode for parallel execution of this node.(package private) java.util.Optional<Node.ExecutionMode>getExecutionModeFromAnnotation(java.lang.reflect.AnnotatedElement element)(package private) java.util.Optional<Node.ExecutionMode>getExplicitExecutionMode()(package private) static java.util.Set<TestTag>getTags(java.lang.reflect.AnnotatedElement element, java.util.function.Supplier<java.lang.String> elementDescription, java.util.function.Supplier<TestSource> sourceProvider, java.util.function.Consumer<DiscoveryIssue> issueCollector)(package private) <E extends org.junit.jupiter.api.extension.Extension>
voidinvokeExecutionExceptionHandlers(java.lang.Class<E> handlerType, ExtensionRegistry registry, java.lang.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(java.util.List<E> exceptionHandlers, java.lang.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.Node.SkipResultshouldBeSkipped(JupiterEngineExecutionContext 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(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.platform.engine.support.descriptor.AbstractTestDescriptor
addChild, equals, findByUniqueId, getChildren, getDisplayName, getParent, getSource, getTags, 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, nodeSkipped
-
Methods inherited from interface org.junit.platform.engine.TestDescriptor
accept, getAncestors, getDescendants, getLegacyReportingName, getType, isContainer, isRoot, isTest, mayRegisterTests, prune
-
-
-
-
Field Detail
-
conditionEvaluator
private static final ConditionEvaluator conditionEvaluator
-
configuration
final JupiterConfiguration configuration
-
-
Constructor Detail
-
JupiterTestDescriptor
JupiterTestDescriptor(UniqueId uniqueId, java.lang.reflect.AnnotatedElement element, java.util.function.Supplier<java.lang.String> displayNameSupplier, TestSource source, JupiterConfiguration configuration)
-
JupiterTestDescriptor
JupiterTestDescriptor(UniqueId uniqueId, java.lang.String displayName, TestSource source, JupiterConfiguration configuration)
-
-
Method Detail
-
getTags
static java.util.Set<TestTag> getTags(java.lang.reflect.AnnotatedElement element, java.util.function.Supplier<java.lang.String> elementDescription, java.util.function.Supplier<TestSource> sourceProvider, java.util.function.Consumer<DiscoveryIssue> issueCollector)
-
invokeExecutionExceptionHandlers
<E extends org.junit.jupiter.api.extension.Extension> void invokeExecutionExceptionHandlers(java.lang.Class<E> handlerType, ExtensionRegistry registry, java.lang.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(java.util.List<E> exceptionHandlers, java.lang.Throwable throwable, JupiterTestDescriptor.ExceptionHandlerInvoker<E> handlerInvoker)
-
getExecutionMode
public Node.ExecutionMode 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:
Node.ExecutionMode
-
getExplicitExecutionMode
java.util.Optional<Node.ExecutionMode> getExplicitExecutionMode()
-
getDefaultChildExecutionMode
java.util.Optional<Node.ExecutionMode> getDefaultChildExecutionMode()
-
getExecutionModeFromAnnotation
java.util.Optional<Node.ExecutionMode> getExecutionModeFromAnnotation(java.lang.reflect.AnnotatedElement element)
-
toExecutionMode
public static Node.ExecutionMode toExecutionMode(org.junit.jupiter.api.parallel.ExecutionMode mode)
-
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>- Returns:
- the set of exclusive resources required by this node; never
nullbut potentially empty - See Also:
ExclusiveResource
-
shouldBeSkipped
public Node.SkipResult shouldBeSkipped(JupiterEngineExecutionContext context)
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 java.lang.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:
java.lang.Exception- See Also:
Node.cleanUp(EngineExecutionContext)
-
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>- Parameters:
context- the context to execute in- Throws:
java.lang.Exception- See Also:
Node.prepare(EngineExecutionContext)
-
copyIncludingDescendants
protected JupiterTestDescriptor copyIncludingDescendants(java.util.function.UnaryOperator<UniqueId> uniqueIdTransformer)
{@return a deep copy (with copies of children) of this descriptor with the supplied unique ID}
-
withUniqueId
protected abstract JupiterTestDescriptor withUniqueId(java.util.function.UnaryOperator<UniqueId> uniqueIdTransformer)
{@return shallow copy (without children) of this descriptor with the supplied unique ID}
-
-