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:
ClassTestDescriptor,TestMethodTestDescriptor,TestTemplateTestDescriptor
@API(status=INTERNAL, since="5.0") public abstract class JupiterTestDescriptor extends AbstractTestDescriptor implements Node<JupiterEngineExecutionContext>
- Since:
- 5.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.junit.platform.engine.support.hierarchical.Node
Node.DynamicTestExecutor, Node.ExecutionMode, Node.SkipResult
-
Nested classes/interfaces inherited from interface org.junit.platform.engine.TestDescriptor
TestDescriptor.Type, TestDescriptor.Visitor
-
-
Field Summary
-
Fields inherited from class org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
children
-
-
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 static <E extends AnnotatedElement>
StringdetermineDisplayName(E element, Function<E,String> defaultDisplayNameGenerator)protected voidexecuteAndMaskThrowable(Executable executable)Execute the suppliedExecutableand mask any exception thrown as an unchecked exception.protected Optional<Node.ExecutionMode>getDefaultChildExecutionMode()protected Set<ExclusiveResource>getExclusiveResourcesFromAnnotation(AnnotatedElement element)Node.ExecutionModegetExecutionMode()Get the preferred of execution mode for parallel execution of this node.protected Optional<Node.ExecutionMode>getExecutionModeFromAnnotation(AnnotatedElement element)protected Optional<Node.ExecutionMode>getExplicitExecutionMode()protected static Set<TestTag>getTags(AnnotatedElement element)abstract JupiterEngineExecutionContextprepare(JupiterEngineExecutionContext context)Must be overridden and return a new context so cleanUp() does not accidentally close the parent context.Node.SkipResultshouldBeSkipped(JupiterEngineExecutionContext context)Determine if the execution of the suppliedcontextshould be skipped.-
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 interface org.junit.platform.engine.support.hierarchical.Node
after, before, execute, getExclusiveResources
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.junit.platform.engine.TestDescriptor
accept, getDescendants, getLegacyReportingName, getType, isContainer, isRoot, isTest, mayRegisterTests, prune
-
-
-
-
Method Detail
-
getTags
protected static Set<TestTag> getTags(AnnotatedElement element)
-
determineDisplayName
protected static <E extends AnnotatedElement> String determineDisplayName(E element, Function<E,String> defaultDisplayNameGenerator)
-
getExecutionMode
public final 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
protected Optional<Node.ExecutionMode> getExplicitExecutionMode()
-
getDefaultChildExecutionMode
protected Optional<Node.ExecutionMode> getDefaultChildExecutionMode()
-
getExecutionModeFromAnnotation
protected Optional<Node.ExecutionMode> getExecutionModeFromAnnotation(AnnotatedElement element)
-
getExclusiveResourcesFromAnnotation
protected Set<ExclusiveResource> getExclusiveResourcesFromAnnotation(AnnotatedElement element)
-
shouldBeSkipped
public Node.SkipResult shouldBeSkipped(JupiterEngineExecutionContext context) throws Exception
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>- Throws:
Exception
-
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:
preparein interfaceNode<JupiterEngineExecutionContext>- Throws:
Exception- See Also:
Node.cleanUp(EngineExecutionContext)
-
cleanUp
public void cleanUp(JupiterEngineExecutionContext context) throws 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:
Exception- See Also:
Node.prepare(EngineExecutionContext)
-
executeAndMaskThrowable
protected void executeAndMaskThrowable(Executable executable)
Execute the suppliedExecutableand mask any exception thrown as an unchecked exception.- Parameters:
executable- theExecutableto execute- See Also:
ExceptionUtils.throwAsUncheckedException(Throwable)
-
-