Class ClassTestDescriptor
- java.lang.Object
-
- org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
-
- org.junit.jupiter.engine.descriptor.JupiterTestDescriptor
-
- org.junit.jupiter.engine.descriptor.ClassTestDescriptor
-
- All Implemented Interfaces:
Node<JupiterEngineExecutionContext>
,TestDescriptor
- Direct Known Subclasses:
NestedClassTestDescriptor
@API(status=INTERNAL, since="5.0") public class ClassTestDescriptor extends JupiterTestDescriptor
TestDescriptor
for tests based on Java classes.Default Display Names
The default display name for a top-level or nested static test class is the fully qualified name of the class with the package name and leading dot (".") removed.
- 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 Modifier and Type Field Description protected TestInstance.Lifecycle
lifecycle
-
Fields inherited from class org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
children
-
-
Constructor Summary
Constructors Modifier Constructor Description ClassTestDescriptor(UniqueId uniqueId, Class<?> testClass, ConfigurationParameters configurationParameters)
protected
ClassTestDescriptor(UniqueId uniqueId, Function<Class<?>,String> defaultDisplayNameGenerator, Class<?> testClass, ConfigurationParameters configurationParameters)
-
Method Summary
All Methods Instance 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.Set<TestTag>
getTags()
Get the set of tags associated with this descriptor.Class<?>
getTestClass()
TestDescriptor.Type
getType()
Determine theTestDescriptor.Type
of this descriptor.protected Object
instantiateTestClass(Optional<Object> outerInstance, ExtensionRegistry registry, ExtensionContext extensionContext)
protected Object
instantiateTestClass(JupiterEngineExecutionContext parentExecutionContext, ExtensionRegistry registry, ExtensionContext extensionContext)
JupiterEngineExecutionContext
prepare(JupiterEngineExecutionContext context)
Must be overridden and return a new context so cleanUp() does not accidentally close the parent context.-
Methods inherited from class org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
addChild, equals, findByUniqueId, getChildren, getDisplayName, getParent, getSource, getUniqueId, hashCode, removeChild, removeFromHierarchy, setParent, toString
-
Methods inherited from class org.junit.jupiter.engine.descriptor.JupiterTestDescriptor
cleanUp, determineDisplayName, executeAndMaskThrowable, getExclusiveResourcesFromAnnotation, getExecutionMode, getExecutionModeFromAnnotation, getTags, shouldBeSkipped
-
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, isContainer, isRoot, isTest, mayRegisterTests, prune
-
-
-
-
Field Detail
-
lifecycle
protected final TestInstance.Lifecycle lifecycle
-
-
Constructor Detail
-
ClassTestDescriptor
public ClassTestDescriptor(UniqueId uniqueId, Class<?> testClass, ConfigurationParameters configurationParameters)
-
-
Method Detail
-
getTags
public Set<TestTag> getTags()
Description copied from interface:TestDescriptor
Get the set of tags associated with this descriptor.- Specified by:
getTags
in interfaceTestDescriptor
- Overrides:
getTags
in classAbstractTestDescriptor
- Returns:
- the set of tags associated with this descriptor; never
null
but potentially empty - See Also:
TestTag
-
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()
- Overrides:
getExplicitExecutionMode
in classJupiterTestDescriptor
-
getDefaultChildExecutionMode
protected Optional<Node.ExecutionMode> getDefaultChildExecutionMode()
- Overrides:
getDefaultChildExecutionMode
in classJupiterTestDescriptor
-
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 Object instantiateTestClass(JupiterEngineExecutionContext parentExecutionContext, ExtensionRegistry registry, ExtensionContext extensionContext)
-
instantiateTestClass
protected Object instantiateTestClass(Optional<Object> outerInstance, ExtensionRegistry registry, ExtensionContext extensionContext)
-
-