Class ClassBasedTestDescriptor
- java.lang.Object
-
- org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
-
- org.junit.jupiter.engine.descriptor.JupiterTestDescriptor
-
- org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor
-
- All Implemented Interfaces:
Node<JupiterEngineExecutionContext>
,TestDescriptor
- Direct Known Subclasses:
ClassTestDescriptor
,NestedClassTestDescriptor
@API(status=INTERNAL, since="5.5") public abstract class ClassBasedTestDescriptor extends JupiterTestDescriptor
TestDescriptor
for tests based on Java classes.- Since:
- 5.5
-
-
Nested Class Summary
-
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 protected TestInstance.Lifecycle
lifecycle
protected Set<TestTag>
tags
-
Fields inherited from class org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
children
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
after(JupiterEngineExecutionContext context)
Execute the after behavior of this node.JupiterEngineExecutionContext
before(JupiterEngineExecutionContext context)
Execute the before behavior of this node.protected Optional<Node.ExecutionMode>
getDefaultChildExecutionMode()
Set<ExclusiveResource>
getExclusiveResources()
Get the set of exclusive resources required to execute this node.protected Optional<Node.ExecutionMode>
getExplicitExecutionMode()
String
getLegacyReportingName()
Get the name of this descriptor in a format that is suitable for legacy reporting infrastructure — for example, for reporting systems built on the Ant-based XML reporting format for JUnit 4.Class<?>
getTestClass()
TestDescriptor.Type
getType()
Determine theTestDescriptor.Type
of this descriptor.protected TestInstances
instantiateTestClass(Optional<TestInstances> outerInstances, ExtensionRegistry registry, ExtensionContext extensionContext)
protected abstract TestInstances
instantiateTestClass(JupiterEngineExecutionContext parentExecutionContext, ExtensionRegistry registry, ExtensionRegistrar registrar, ExtensionContext extensionContext)
JupiterEngineExecutionContext
prepare(JupiterEngineExecutionContext context)
Must be overridden and return a new context so cleanUp() does not accidentally close the parent context.void
setDefaultChildExecutionMode(Node.ExecutionMode defaultChildExecutionMode)
-
Methods inherited from class org.junit.jupiter.engine.descriptor.JupiterTestDescriptor
cleanUp, getExecutionMode, shouldBeSkipped, toExecutionMode
-
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
around, execute, nodeFinished, nodeSkipped
-
Methods inherited from interface org.junit.platform.engine.TestDescriptor
accept, getDescendants, isContainer, isRoot, isTest, mayRegisterTests, prune
-
-
-
-
Field Detail
-
lifecycle
protected final TestInstance.Lifecycle lifecycle
-
-
Method Detail
-
getTestClass
public final Class<?> getTestClass()
-
getType
public TestDescriptor.Type getType()
Description copied from interface:TestDescriptor
Determine theTestDescriptor.Type
of this descriptor.- Returns:
- the descriptor type; never
null
. - See Also:
TestDescriptor.isContainer()
,TestDescriptor.isTest()
-
getLegacyReportingName
public String getLegacyReportingName()
Description copied from interface:TestDescriptor
Get the name of this descriptor in a format that is suitable for legacy reporting infrastructure — for example, for reporting systems built on the Ant-based XML reporting format for JUnit 4.The default implementation simply delegates to
TestDescriptor.getDisplayName()
.- Returns:
- the legacy reporting name; never
null
or blank
-
getExplicitExecutionMode
protected Optional<Node.ExecutionMode> getExplicitExecutionMode()
-
getDefaultChildExecutionMode
protected Optional<Node.ExecutionMode> getDefaultChildExecutionMode()
-
setDefaultChildExecutionMode
public void setDefaultChildExecutionMode(Node.ExecutionMode defaultChildExecutionMode)
-
getExclusiveResources
public Set<ExclusiveResource> getExclusiveResources()
Description copied from interface:Node
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 - See Also:
ExclusiveResource
-
prepare
public JupiterEngineExecutionContext prepare(JupiterEngineExecutionContext context)
Description copied from class:JupiterTestDescriptor
Must be overridden and return a new context so cleanUp() does not accidentally close the parent context.- Specified by:
prepare
in interfaceNode<JupiterEngineExecutionContext>
- Specified by:
prepare
in classJupiterTestDescriptor
- See Also:
Node.cleanUp(EngineExecutionContext)
-
before
public JupiterEngineExecutionContext before(JupiterEngineExecutionContext context)
Description copied from interface:Node
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
- See Also:
Node.execute(EngineExecutionContext, DynamicTestExecutor)
,Node.after(EngineExecutionContext)
-
after
public void after(JupiterEngineExecutionContext context)
Description copied from interface:Node
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- See Also:
Node.before(C)
,Node.execute(C, org.junit.platform.engine.support.hierarchical.Node.DynamicTestExecutor)
-
instantiateTestClass
protected abstract TestInstances instantiateTestClass(JupiterEngineExecutionContext parentExecutionContext, ExtensionRegistry registry, ExtensionRegistrar registrar, ExtensionContext extensionContext)
-
instantiateTestClass
protected TestInstances instantiateTestClass(Optional<TestInstances> outerInstances, ExtensionRegistry registry, ExtensionContext extensionContext)
-
-