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
,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 interface
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
FieldsModifier and TypeFieldDescriptionprivate static final ConditionEvaluator
(package private) final JupiterConfiguration
private static final org.junit.platform.commons.logging.Logger
Fields inherited from class org.junit.platform.engine.support.descriptor.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 TypeMethodDescriptionvoid
cleanUp
(JupiterEngineExecutionContext context) Clean up the suppliedcontext
after execution.(package private) Optional
<Node.ExecutionMode> (package private) Set
<ExclusiveResource> 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) (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 suppliedThrowable
one-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 JupiterEngineExecutionContext
prepare
(JupiterEngineExecutionContext context) Must be overridden and return a new context so cleanUp() does not accidentally close the parent context.Determine if the execution of the suppliedcontext
should be skipped.static Node.ExecutionMode
toExecutionMode
(org.junit.jupiter.api.parallel.ExecutionMode mode) private static ExclusiveResource.LockMode
toLockMode
(org.junit.jupiter.api.parallel.ResourceAccessMode mode) private Node.SkipResult
toSkipResult
(org.junit.jupiter.api.extension.ConditionEvaluationResult evaluationResult) Methods inherited from class org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
addChild, equals, findByUniqueId, getChildren, getDisplayName, getParent, getSource, getTags, getUniqueId, hashCode, 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, getExclusiveResources, nodeFinished, nodeSkipped
Methods inherited from interface org.junit.platform.engine.TestDescriptor
accept, getAncestors, getDescendants, getLegacyReportingName, getType, isContainer, isRoot, isTest, mayRegisterTests, prune
-
Field Details
-
logger
private static final org.junit.platform.commons.logging.Logger logger -
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
-
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 suppliedThrowable
one-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:Node
Get the preferred of execution mode for parallel execution of this node.The default implementation returns
Node.ExecutionMode.CONCURRENT
.- Specified by:
getExecutionMode
in 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
-
getExclusiveResourcesFromAnnotation
-
toLockMode
private static ExclusiveResource.LockMode toLockMode(org.junit.jupiter.api.parallel.ResourceAccessMode mode) -
shouldBeSkipped
Description copied from interface:Node
Determine if the execution of the suppliedcontext
should be skipped.The default implementation returns
Node.SkipResult.doNotSkip()
.- Specified by:
shouldBeSkipped
in interfaceNode<JupiterEngineExecutionContext>
- Throws:
Exception
-
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 so cleanUp() does not accidentally close the parent context.- Specified by:
prepare
in interfaceNode<JupiterEngineExecutionContext>
- Throws:
Exception
- 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>
- Parameters:
context
- the context to execute in- Throws:
Exception
- See Also:
-