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 Classes Modifier and Type Class Description (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
Fields Modifier and Type Field Description private static ConditionEvaluator
conditionEvaluator
(package private) JupiterConfiguration
configuration
private static org.junit.platform.commons.logging.Logger
logger
-
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 void
cleanUp(JupiterEngineExecutionContext context)
Clean up the suppliedcontext
after execution.(package private) java.util.Optional<Node.ExecutionMode>
getDefaultChildExecutionMode()
(package private) java.util.Set<ExclusiveResource>
getExclusiveResourcesFromAnnotation(java.lang.reflect.AnnotatedElement element)
Node.ExecutionMode
getExecutionMode()
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)
(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 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(java.util.List<E> exceptionHandlers, java.lang.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.Node.SkipResult
shouldBeSkipped(JupiterEngineExecutionContext 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 Detail
-
logger
private static final org.junit.platform.commons.logging.Logger logger
-
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)
-
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 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(java.util.List<E> exceptionHandlers, java.lang.Throwable throwable, JupiterTestDescriptor.ExceptionHandlerInvoker<E> handlerInvoker)
-
getExecutionMode
public Node.ExecutionMode 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:
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)
-
getExclusiveResourcesFromAnnotation
java.util.Set<ExclusiveResource> getExclusiveResourcesFromAnnotation(java.lang.reflect.AnnotatedElement element)
-
toLockMode
private static ExclusiveResource.LockMode toLockMode(org.junit.jupiter.api.parallel.ResourceAccessMode mode)
-
shouldBeSkipped
public Node.SkipResult shouldBeSkipped(JupiterEngineExecutionContext context) throws java.lang.Exception
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:
java.lang.Exception
-
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 so cleanUp() does not accidentally close the parent context.- Specified by:
prepare
in 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: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:
java.lang.Exception
- See Also:
Node.prepare(EngineExecutionContext)
-
-