@API(status=INTERNAL, since="5.0") public class ClassTestDescriptor extends JupiterTestDescriptor
TestDescriptor
for tests based on Java classes.
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.
Node.DynamicTestExecutor, Node.ExecutionMode, Node.Invocation<C extends EngineExecutionContext>, Node.SkipResult
TestDescriptor.Type, TestDescriptor.Visitor
Modifier and Type | Field and Description |
---|---|
private java.util.List<java.lang.reflect.Method> |
afterAllMethods |
private java.util.List<java.lang.reflect.Method> |
beforeAllMethods |
private Node.ExecutionMode |
defaultChildExecutionMode |
private static ExecutableInvoker |
executableInvoker |
protected TestInstance.Lifecycle |
lifecycle |
private java.util.Set<TestTag> |
tags |
private java.lang.Class<?> |
testClass |
private TestInstanceFactory |
testInstanceFactory |
configuration
children
Constructor and Description |
---|
ClassTestDescriptor(UniqueId uniqueId,
java.lang.Class<?> testClass,
JupiterConfiguration configuration) |
ClassTestDescriptor(UniqueId uniqueId,
java.lang.Class<?> testClass,
java.util.function.Supplier<java.lang.String> displayNameSupplier,
JupiterConfiguration configuration) |
Modifier and Type | Method and Description |
---|---|
void |
after(JupiterEngineExecutionContext context)
Execute the after behavior of this node.
|
JupiterEngineExecutionContext |
before(JupiterEngineExecutionContext context)
Execute the before behavior of this node.
|
protected java.util.Optional<Node.ExecutionMode> |
getDefaultChildExecutionMode() |
java.util.Set<ExclusiveResource> |
getExclusiveResources()
Get the set of exclusive resources
required to execute this node.
|
protected java.util.Optional<Node.ExecutionMode> |
getExplicitExecutionMode() |
java.lang.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.
|
java.util.Set<TestTag> |
getTags()
Get the set of tags associated with this descriptor.
|
java.lang.Class<?> |
getTestClass() |
TestDescriptor.Type |
getType()
Determine the
TestDescriptor.Type of this descriptor. |
private TestInstances |
instantiateAndPostProcessTestInstance(JupiterEngineExecutionContext parentExecutionContext,
ExtensionContext extensionContext,
ExtensionRegistry registry) |
protected TestInstances |
instantiateTestClass(JupiterEngineExecutionContext parentExecutionContext,
ExtensionRegistry registry,
ExtensionContext extensionContext) |
protected TestInstances |
instantiateTestClass(java.util.Optional<TestInstances> outerInstances,
ExtensionRegistry registry,
ExtensionContext extensionContext) |
private void |
invokeAfterAllCallbacks(JupiterEngineExecutionContext context) |
private void |
invokeAfterAllMethods(JupiterEngineExecutionContext context) |
private void |
invokeBeforeAllCallbacks(JupiterEngineExecutionContext context) |
private void |
invokeBeforeAllMethods(JupiterEngineExecutionContext context) |
private void |
invokeMethodInExtensionContext(java.lang.reflect.Method method,
ExtensionContext context,
ExtensionRegistry registry) |
private java.lang.Object |
invokeTestClassConstructor(java.util.Optional<java.lang.Object> outerInstance,
ExtensionRegistry registry,
ExtensionContext extensionContext) |
private java.lang.Object |
invokeTestInstanceFactory(java.util.Optional<java.lang.Object> outerInstance,
ExtensionContext extensionContext) |
private void |
invokeTestInstancePostProcessors(java.lang.Object instance,
ExtensionRegistry registry,
ExtensionContext context) |
JupiterEngineExecutionContext |
prepare(JupiterEngineExecutionContext context)
Must be overridden and return a new context so cleanUp() does not accidentally close the parent context.
|
private void |
registerAfterEachMethodAdapters(ExtensionRegistry registry) |
private void |
registerBeforeEachMethodAdapters(ExtensionRegistry registry) |
private void |
registerMethodsAsExtensions(java.util.List<java.lang.reflect.Method> methods,
ExtensionRegistry registry,
java.util.function.Function<java.lang.reflect.Method,Extension> extensionSynthesizer) |
private TestInstanceFactory |
resolveTestInstanceFactory(ExtensionRegistry registry) |
void |
setDefaultChildExecutionMode(Node.ExecutionMode defaultChildExecutionMode) |
private AfterEachMethodAdapter |
synthesizeAfterEachMethodAdapter(java.lang.reflect.Method method) |
private BeforeEachMethodAdapter |
synthesizeBeforeEachMethodAdapter(java.lang.reflect.Method method) |
private TestInstancesProvider |
testInstancesProvider(JupiterEngineExecutionContext parentExecutionContext,
ExtensionRegistry registry,
ClassExtensionContext extensionContext) |
cleanUp, executeAndMaskThrowable, getExclusiveResourcesFromAnnotation, getExecutionMode, getExecutionModeFromAnnotation, getTags, shouldBeSkipped, toExecutionMode
addChild, equals, findByUniqueId, getChildren, getDisplayName, getParent, getSource, getUniqueId, hashCode, removeChild, removeFromHierarchy, setParent, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
around, execute, nodeFinished, nodeSkipped
accept, containsTests, getDescendants, isContainer, isRoot, isTest, mayRegisterTests, prune
private static final ExecutableInvoker executableInvoker
private final java.lang.Class<?> testClass
private final java.util.Set<TestTag> tags
protected final TestInstance.Lifecycle lifecycle
private Node.ExecutionMode defaultChildExecutionMode
private TestInstanceFactory testInstanceFactory
private java.util.List<java.lang.reflect.Method> beforeAllMethods
private java.util.List<java.lang.reflect.Method> afterAllMethods
public ClassTestDescriptor(UniqueId uniqueId, java.lang.Class<?> testClass, JupiterConfiguration configuration)
ClassTestDescriptor(UniqueId uniqueId, java.lang.Class<?> testClass, java.util.function.Supplier<java.lang.String> displayNameSupplier, JupiterConfiguration configuration)
public java.util.Set<TestTag> getTags()
TestDescriptor
getTags
in interface TestDescriptor
getTags
in class AbstractTestDescriptor
null
but potentially emptyTestTag
public final java.lang.Class<?> getTestClass()
public TestDescriptor.Type getType()
TestDescriptor
TestDescriptor.Type
of this descriptor.null
.TestDescriptor.isContainer()
,
TestDescriptor.isTest()
public java.lang.String getLegacyReportingName()
TestDescriptor
The default implementation simply delegates to TestDescriptor.getDisplayName()
.
null
or blankprotected java.util.Optional<Node.ExecutionMode> getExplicitExecutionMode()
getExplicitExecutionMode
in class JupiterTestDescriptor
protected java.util.Optional<Node.ExecutionMode> getDefaultChildExecutionMode()
getDefaultChildExecutionMode
in class JupiterTestDescriptor
public void setDefaultChildExecutionMode(Node.ExecutionMode defaultChildExecutionMode)
public java.util.Set<ExclusiveResource> getExclusiveResources()
Node
The default implementation returns an empty set.
null
but potentially emptyExclusiveResource
public JupiterEngineExecutionContext prepare(JupiterEngineExecutionContext context)
JupiterTestDescriptor
prepare
in interface Node<JupiterEngineExecutionContext>
prepare
in class JupiterTestDescriptor
Node.cleanUp(EngineExecutionContext)
public JupiterEngineExecutionContext before(JupiterEngineExecutionContext context)
Node
This method will be called once before execution of this node.
The default implementation returns the supplied context
unmodified.
context
- the context to execute innull
Node.execute(EngineExecutionContext, DynamicTestExecutor)
,
Node.after(EngineExecutionContext)
public void after(JupiterEngineExecutionContext context)
Node
This method will be called once after execution of this node.
The default implementation does nothing.
context
- the context to execute inNode.before(C)
,
Node.execute(C, org.junit.platform.engine.support.hierarchical.Node.DynamicTestExecutor)
private TestInstanceFactory resolveTestInstanceFactory(ExtensionRegistry registry)
private TestInstancesProvider testInstancesProvider(JupiterEngineExecutionContext parentExecutionContext, ExtensionRegistry registry, ClassExtensionContext extensionContext)
private TestInstances instantiateAndPostProcessTestInstance(JupiterEngineExecutionContext parentExecutionContext, ExtensionContext extensionContext, ExtensionRegistry registry)
protected TestInstances instantiateTestClass(JupiterEngineExecutionContext parentExecutionContext, ExtensionRegistry registry, ExtensionContext extensionContext)
protected TestInstances instantiateTestClass(java.util.Optional<TestInstances> outerInstances, ExtensionRegistry registry, ExtensionContext extensionContext)
private java.lang.Object invokeTestInstanceFactory(java.util.Optional<java.lang.Object> outerInstance, ExtensionContext extensionContext)
private java.lang.Object invokeTestClassConstructor(java.util.Optional<java.lang.Object> outerInstance, ExtensionRegistry registry, ExtensionContext extensionContext)
private void invokeTestInstancePostProcessors(java.lang.Object instance, ExtensionRegistry registry, ExtensionContext context)
private void invokeBeforeAllCallbacks(JupiterEngineExecutionContext context)
private void invokeBeforeAllMethods(JupiterEngineExecutionContext context)
private void invokeAfterAllMethods(JupiterEngineExecutionContext context)
private void invokeAfterAllCallbacks(JupiterEngineExecutionContext context)
private void registerBeforeEachMethodAdapters(ExtensionRegistry registry)
private void registerAfterEachMethodAdapters(ExtensionRegistry registry)
private void registerMethodsAsExtensions(java.util.List<java.lang.reflect.Method> methods, ExtensionRegistry registry, java.util.function.Function<java.lang.reflect.Method,Extension> extensionSynthesizer)
private BeforeEachMethodAdapter synthesizeBeforeEachMethodAdapter(java.lang.reflect.Method method)
private AfterEachMethodAdapter synthesizeAfterEachMethodAdapter(java.lang.reflect.Method method)
private void invokeMethodInExtensionContext(java.lang.reflect.Method method, ExtensionContext context, ExtensionRegistry registry)