Module org.junit.jupiter.engine
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:
TestClassAware
,Validatable
,Node<JupiterEngineExecutionContext>
,TestDescriptor
- Direct Known Subclasses:
ClassTemplateTestDescriptor
,ClassTestDescriptor
,NestedClassTestDescriptor
@API(status=INTERNAL,
since="5.5")
public abstract class ClassBasedTestDescriptor
extends JupiterTestDescriptor
implements TestClassAware, Validatable
TestDescriptor
for tests based on Java classes.- Since:
- 5.5
-
Nested Class Summary
Nested ClassesNested 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
FieldsFields inherited from class org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
children
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
after
(JupiterEngineExecutionContext context) Execute the after behavior of this node.before
(JupiterEngineExecutionContext context) Execute the before behavior of this node.void
cleanUp
(JupiterEngineExecutionContext context) Clean up the suppliedcontext
after execution.default Stream
<ExclusiveResource> default Stream
<ExclusiveResource> determineOwnExclusiveResources
(Function<ResourceLocksProvider, Set<ResourceLocksProvider.Lock>> providerToLocks) protected final Optional
<Node.ExecutionMode> final org.junit.jupiter.engine.descriptor.ExclusiveResourceCollector
protected final Optional
<Node.ExecutionMode> final String
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.final Class
<?> final TestDescriptor.Type
getType()
Determine theTestDescriptor.Type
of this descriptor.protected final TestInstances
instantiateTestClass
(Optional<TestInstances> outerInstances, ExtensionRegistry registry, ExtensionContextSupplier extensionContext) protected abstract TestInstances
instantiateTestClass
(JupiterEngineExecutionContext parentExecutionContext, ExtensionContextSupplier extensionContext, ExtensionRegistry registry, JupiterEngineExecutionContext context) prepare
(JupiterEngineExecutionContext context) Must be overridden and return a new context with a newExtensionContext
so cleanUp() does not accidentally close the parent context.final void
setDefaultChildExecutionMode
(Node.ExecutionMode defaultChildExecutionMode) final void
validate
(DiscoveryIssueReporter reporter) Validate the state of this descriptor and report any issues found to the suppliedDiscoveryIssueReporter
.protected void
protected void
Methods inherited from class org.junit.jupiter.engine.descriptor.JupiterTestDescriptor
copyIncludingDescendants, getExclusiveResources, getExecutionMode, shouldBeSkipped, toExecutionMode, withUniqueId
Methods inherited from class org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
addChild, equals, findByUniqueId, getChildren, getDisplayName, getParent, getSource, getTags, getUniqueId, hashCode, orderChildren, 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.jupiter.engine.descriptor.TestClassAware
getEnclosingTestClasses
Methods inherited from interface org.junit.platform.engine.TestDescriptor
accept, addChild, findByUniqueId, getAncestors, getChildren, getDescendants, getDisplayName, getParent, getSource, getTags, getUniqueId, isContainer, isRoot, isTest, mayRegisterTests, orderChildren, prune, removeChild, removeFromHierarchy, setParent
-
Field Details
-
classInfo
-
-
Method Details
-
getTestClass
- Specified by:
getTestClass
in interfaceTestClassAware
-
getType
Description copied from interface:TestDescriptor
Determine theTestDescriptor.Type
of this descriptor.- Specified by:
getType
in interfaceTestDescriptor
- Returns:
- the descriptor type; never
null
. - See Also:
-
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 delegates to
TestDescriptor.getDisplayName()
.- Specified by:
getLegacyReportingName
in interfaceTestDescriptor
- Returns:
- the legacy reporting name; never
null
or blank
-
validate
Description copied from interface:Validatable
Validate the state of this descriptor and report any issues found to the suppliedDiscoveryIssueReporter
.- Specified by:
validate
in interfaceValidatable
-
validateCoreLifecycleMethods
-
validateClassTemplateInvocationLifecycleMethods
-
getExplicitExecutionMode
-
getDefaultChildExecutionMode
-
setDefaultChildExecutionMode
-
getExclusiveResourceCollector
public final org.junit.jupiter.engine.descriptor.ExclusiveResourceCollector getExclusiveResourceCollector() -
prepare
Description copied from class:JupiterTestDescriptor
Must be overridden and return a new context with a newExtensionContext
so cleanUp() does not accidentally close the parent context.- Specified by:
prepare
in interfaceNode<JupiterEngineExecutionContext>
- Specified by:
prepare
in classJupiterTestDescriptor
- See Also:
-
before
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.- Specified by:
before
in interfaceNode<JupiterEngineExecutionContext>
- Parameters:
context
- the context to execute in- Returns:
- the new context to be used for children of this node; never
null
- See Also:
-
after
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.
- Specified by:
after
in interfaceNode<JupiterEngineExecutionContext>
- Parameters:
context
- the context to execute in- See Also:
-
cleanUp
Description copied from interface:Node
Clean up the suppliedcontext
after execution.The default implementation does nothing.
- Specified by:
cleanUp
in interfaceNode<JupiterEngineExecutionContext>
- Overrides:
cleanUp
in classJupiterTestDescriptor
- Parameters:
context
- the context to execute in- Throws:
Exception
- See Also:
-
instantiateTestClass
protected abstract TestInstances instantiateTestClass(JupiterEngineExecutionContext parentExecutionContext, ExtensionContextSupplier extensionContext, ExtensionRegistry registry, JupiterEngineExecutionContext context) -
instantiateTestClass
protected final TestInstances instantiateTestClass(Optional<TestInstances> outerInstances, ExtensionRegistry registry, ExtensionContextSupplier extensionContext) -
determineExclusiveResources
-
determineOwnExclusiveResources
default Stream<ExclusiveResource> determineOwnExclusiveResources(Function<ResourceLocksProvider, Set<ResourceLocksProvider.Lock>> providerToLocks) -
getResourceLocksProviderEvaluator
Function<ResourceLocksProvider,Set<ResourceLocksProvider.Lock>> getResourceLocksProviderEvaluator()
-