Interface Node<C extends EngineExecutionContext>
-
- Type Parameters:
C
- the type ofEngineExecutionContext
used by theHierarchicalTestEngine
- All Known Implementing Classes:
ClassTestDescriptor
,JupiterEngineDescriptor
,JupiterTestDescriptor
,MethodBasedTestDescriptor
,NestedClassTestDescriptor
,TestFactoryTestDescriptor
,TestMethodTestDescriptor
,TestTemplateInvocationTestDescriptor
,TestTemplateTestDescriptor
@API(status=MAINTAINED, since="1.0", consumers="org.junit.platform.engine.support.hierarchical") public interface Node<C extends EngineExecutionContext>
A node within the execution hierarchy.- Since:
- 1.0
- See Also:
HierarchicalTestEngine
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Node.DynamicTestExecutor
Executor for additional, dynamic test descriptors discovered during execution of aNode
.static class
Node.ExecutionMode
Supported execution modes for parallel execution.static interface
Node.Invocation<C extends EngineExecutionContext>
Represents an invocation that runs with the supplied context.static class
Node.SkipResult
The result of determining whether the execution of a givencontext
should be skipped.
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default void
after(C context)
Execute the after behavior of this node.default void
around(C context, Node.Invocation<C> invocation)
Wraps around the invocation ofbefore(EngineExecutionContext)
,execute(EngineExecutionContext, DynamicTestExecutor)
, andafter(EngineExecutionContext)
.default C
before(C context)
Execute the before behavior of this node.default void
cleanUp(C context)
Clean up the suppliedcontext
after execution.default C
execute(C context, Node.DynamicTestExecutor dynamicTestExecutor)
Execute the behavior of this node.default Set<ExclusiveResource>
getExclusiveResources()
Get the set of exclusive resources required to execute this node.default Node.ExecutionMode
getExecutionMode()
Get the preferred of execution mode for parallel execution of this node.default void
nodeFinished(C context, TestDescriptor testDescriptor, TestExecutionResult result)
Callback invoked when the execution of this node has finished.default void
nodeSkipped(C context, TestDescriptor testDescriptor, Node.SkipResult result)
Callback invoked when the execution of this node has been skipped.default C
prepare(C context)
Prepare the suppliedcontext
prior to execution.default Node.SkipResult
shouldBeSkipped(C context)
Determine if the execution of the suppliedcontext
should be skipped.
-
-
-
Method Detail
-
prepare
default C prepare(C context) throws Exception
Prepare the suppliedcontext
prior to execution.The default implementation returns the supplied
context
unmodified.- Throws:
Exception
- See Also:
cleanUp(EngineExecutionContext)
-
cleanUp
default void cleanUp(C context) throws Exception
Clean up the suppliedcontext
after execution.The default implementation does nothing.
- Parameters:
context
- the context to execute in- Throws:
Exception
- Since:
- 1.1
- See Also:
prepare(EngineExecutionContext)
-
shouldBeSkipped
default Node.SkipResult shouldBeSkipped(C context) throws Exception
Determine if the execution of the suppliedcontext
should be skipped.The default implementation returns
Node.SkipResult.doNotSkip()
.- Throws:
Exception
-
before
default C before(C context) throws Exception
Execute the before behavior of this node.This method will be called once before execution of this node.
The default implementation returns the supplied
context
unmodified.- Parameters:
context
- the context to execute in- Returns:
- the new context to be used for children of this node; never
null
- Throws:
Exception
- See Also:
execute(EngineExecutionContext, DynamicTestExecutor)
,after(EngineExecutionContext)
-
execute
default C execute(C context, Node.DynamicTestExecutor dynamicTestExecutor) throws Exception
Execute the behavior of this node.Containers typically do not implement this method since the
HierarchicalTestEngine
handles execution of their children.The supplied
dynamicTestExecutor
may be used to submit additional dynamic tests for immediate execution.The default implementation returns the supplied
context
unmodified.
-
after
default void after(C context) throws Exception
Execute the after behavior of this node.This method will be called once after execution of this node.
The default implementation does nothing.
- Parameters:
context
- the context to execute in- Throws:
Exception
- See Also:
before(C)
,execute(C, org.junit.platform.engine.support.hierarchical.Node.DynamicTestExecutor)
-
around
@API(status=EXPERIMENTAL, since="1.4") default void around(C context, Node.Invocation<C> invocation) throws Exception
Wraps around the invocation ofbefore(EngineExecutionContext)
,execute(EngineExecutionContext, DynamicTestExecutor)
, andafter(EngineExecutionContext)
.- Parameters:
context
- context the context to execute ininvocation
- the wrapped invocation (must be invoked exactly once)- Throws:
Exception
- Since:
- 1.4
-
nodeSkipped
@API(status=EXPERIMENTAL, since="1.4", consumers="org.junit.platform.engine.support.hierarchical") default void nodeSkipped(C context, TestDescriptor testDescriptor, Node.SkipResult result)
Callback invoked when the execution of this node has been skipped.The default implementation does nothing.
- Parameters:
context
- the execution contexttestDescriptor
- the test descriptor that was skippedresult
- the result of skipped execution- Since:
- 1.4
-
nodeFinished
@API(status=EXPERIMENTAL, since="1.4", consumers="org.junit.platform.engine.support.hierarchical") default void nodeFinished(C context, TestDescriptor testDescriptor, TestExecutionResult result)
Callback invoked when the execution of this node has finished.The default implementation does nothing.
- Parameters:
context
- the execution contexttestDescriptor
- the test descriptor that was executedresult
- the result of the execution- Since:
- 1.4
-
getExclusiveResources
@API(status=EXPERIMENTAL, since="1.3", consumers="org.junit.platform.engine.support.hierarchical") default Set<ExclusiveResource> getExclusiveResources()
Get the set of exclusive resources required to execute this node.The default implementation returns an empty set.
- Returns:
- the set of exclusive resources required by this node; never
null
but potentially empty - Since:
- 1.3
- See Also:
ExclusiveResource
-
getExecutionMode
@API(status=EXPERIMENTAL, since="1.3", consumers="org.junit.platform.engine.support.hierarchical") default Node.ExecutionMode getExecutionMode()
Get the preferred of execution mode for parallel execution of this node.The default implementation returns
Node.ExecutionMode.CONCURRENT
.- Returns:
- the preferred execution mode of this node; never
null
- Since:
- 1.3
- See Also:
Node.ExecutionMode
-
-