@API(status=INTERNAL, since="5.0") public abstract class JupiterTestDescriptor extends AbstractTestDescriptor implements Node<JupiterEngineExecutionContext>
Node.DynamicTestExecutor, Node.ExecutionMode, Node.Invocation<C extends EngineExecutionContext>, Node.SkipResult
TestDescriptor.Type, TestDescriptor.Visitor
Modifier and Type | Field and Description |
---|---|
private static ConditionEvaluator |
conditionEvaluator |
protected JupiterConfiguration |
configuration |
private static Logger |
logger |
children
Constructor and 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) |
Modifier and Type | Method and Description |
---|---|
void |
cleanUp(JupiterEngineExecutionContext context)
Clean up the supplied
context after execution. |
protected void |
executeAndMaskThrowable(Executable executable)
Execute the supplied
Executable and
mask any
exception thrown as an unchecked exception. |
protected java.util.Optional<Node.ExecutionMode> |
getDefaultChildExecutionMode() |
protected 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.
|
protected java.util.Optional<Node.ExecutionMode> |
getExecutionModeFromAnnotation(java.lang.reflect.AnnotatedElement element) |
protected java.util.Optional<Node.ExecutionMode> |
getExplicitExecutionMode() |
protected static java.util.Set<TestTag> |
getTags(java.lang.reflect.AnnotatedElement element) |
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 supplied
context should be
skipped. |
static Node.ExecutionMode |
toExecutionMode(ExecutionMode mode) |
private static ExclusiveResource.LockMode |
toLockMode(ResourceAccessMode mode) |
private Node.SkipResult |
toSkipResult(ConditionEvaluationResult evaluationResult) |
addChild, equals, findByUniqueId, getChildren, getDisplayName, getParent, getSource, getTags, getUniqueId, hashCode, removeChild, removeFromHierarchy, setParent, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
after, around, before, execute, getExclusiveResources, nodeFinished, nodeSkipped
accept, containsTests, getDescendants, getLegacyReportingName, getType, isContainer, isRoot, isTest, mayRegisterTests, prune
private static final Logger logger
private static final ConditionEvaluator conditionEvaluator
protected final JupiterConfiguration configuration
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)
protected static java.util.Set<TestTag> getTags(java.lang.reflect.AnnotatedElement element)
public final Node.ExecutionMode getExecutionMode()
Node
The default implementation returns Node.ExecutionMode.CONCURRENT
.
getExecutionMode
in interface Node<JupiterEngineExecutionContext>
null
Node.ExecutionMode
protected java.util.Optional<Node.ExecutionMode> getExplicitExecutionMode()
protected java.util.Optional<Node.ExecutionMode> getDefaultChildExecutionMode()
protected java.util.Optional<Node.ExecutionMode> getExecutionModeFromAnnotation(java.lang.reflect.AnnotatedElement element)
public static Node.ExecutionMode toExecutionMode(ExecutionMode mode)
protected java.util.Set<ExclusiveResource> getExclusiveResourcesFromAnnotation(java.lang.reflect.AnnotatedElement element)
private static ExclusiveResource.LockMode toLockMode(ResourceAccessMode mode)
public Node.SkipResult shouldBeSkipped(JupiterEngineExecutionContext context) throws java.lang.Exception
Node
context
should be
skipped.
The default implementation returns Node.SkipResult.doNotSkip()
.
shouldBeSkipped
in interface Node<JupiterEngineExecutionContext>
java.lang.Exception
private Node.SkipResult toSkipResult(ConditionEvaluationResult evaluationResult)
public abstract JupiterEngineExecutionContext prepare(JupiterEngineExecutionContext context) throws java.lang.Exception
prepare
in interface Node<JupiterEngineExecutionContext>
java.lang.Exception
Node.cleanUp(EngineExecutionContext)
public void cleanUp(JupiterEngineExecutionContext context) throws java.lang.Exception
Node
context
after execution.
The default implementation does nothing.
cleanUp
in interface Node<JupiterEngineExecutionContext>
context
- the context to execute injava.lang.Exception
Node.prepare(EngineExecutionContext)
protected void executeAndMaskThrowable(Executable executable)
Executable
and
mask any
exception thrown as an unchecked exception.executable
- the Executable
to executeExceptionUtils.throwAsUncheckedException(Throwable)