Class TestMethodTestDescriptor
java.lang.Object
org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
org.junit.jupiter.engine.descriptor.JupiterTestDescriptor
org.junit.jupiter.engine.descriptor.MethodBasedTestDescriptor
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor
- All Implemented Interfaces:
TestClassAware,Validatable,org.junit.platform.engine.support.hierarchical.Node<JupiterEngineExecutionContext>,org.junit.platform.engine.TestDescriptor
- Direct Known Subclasses:
TestFactoryTestDescriptor,TestTemplateInvocationTestDescriptor
@API(status=INTERNAL,
since="5.0")
public class TestMethodTestDescriptor
extends MethodBasedTestDescriptor
TestDescriptor for @Test methods.
Default Display Names
The default display name for a test method is the name of the method
concatenated with a comma-separated list of parameter types in parentheses.
The names of parameter types are retrieved using Class.getSimpleName().
For example, the default display name for the following test method is
testUser(TestInfo, User).
@Test
void testUser(TestInfo testInfo, @Mock User user) { ... }
- Since:
- 5.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.junit.platform.engine.support.hierarchical.Node
org.junit.platform.engine.support.hierarchical.Node.DynamicTestExecutor, org.junit.platform.engine.support.hierarchical.Node.ExecutionMode, org.junit.platform.engine.support.hierarchical.Node.Invocation<C extends org.junit.platform.engine.support.hierarchical.EngineExecutionContext>, org.junit.platform.engine.support.hierarchical.Node.SkipResultNested classes/interfaces inherited from interface org.junit.platform.engine.TestDescriptor
org.junit.platform.engine.TestDescriptor.Type, org.junit.platform.engine.TestDescriptor.Visitor -
Field Summary
FieldsFields inherited from class org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
children -
Constructor Summary
ConstructorsConstructorDescriptionTestMethodTestDescriptor(org.junit.platform.engine.UniqueId uniqueId, Class<?> testClass, Method testMethod, Supplier<List<Class<?>>> enclosingInstanceTypes, JupiterConfiguration configuration) -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanUp(JupiterEngineExecutionContext context) default Stream<org.junit.platform.engine.support.hierarchical.ExclusiveResource> default Stream<org.junit.platform.engine.support.hierarchical.ExclusiveResource> determineOwnExclusiveResources(Function<org.junit.jupiter.api.parallel.ResourceLocksProvider, Set<org.junit.jupiter.api.parallel.ResourceLocksProvider.Lock>> providerToLocks) execute(JupiterEngineExecutionContext context, org.junit.platform.engine.support.hierarchical.Node.DynamicTestExecutor dynamicTestExecutor) org.junit.platform.engine.TestDescriptor.TypegetType()protected voidinvokeTestMethod(JupiterEngineExecutionContext context, org.junit.platform.engine.support.hierarchical.Node.DynamicTestExecutor dynamicTestExecutor) voidnodeFinished(JupiterEngineExecutionContext context, org.junit.platform.engine.TestDescriptor descriptor, org.junit.platform.engine.TestExecutionResult result) InvoketestSuccessful(),testAborted(), ortestFailed()on each registeredTestWatcheraccording to the status of the suppliedTestExecutionResult, in reverse registration order.protected MutableExtensionRegistryprepare(JupiterEngineExecutionContext context) Must be overridden and return a new context with a newExtensionContextso cleanUp() does not accidentally close the parent context.protected voidprepareExtensionContext(org.junit.jupiter.api.extension.ExtensionContext extensionContext) protected TestMethodTestDescriptorwithUniqueId(UnaryOperator<org.junit.platform.engine.UniqueId> uniqueIdTransformer) Returns shallow copy (without children) of this descriptor with the supplied unique ID.Methods inherited from class org.junit.jupiter.engine.descriptor.MethodBasedTestDescriptor
getEnclosingTestClasses, getExclusiveResourceCollector, getExplicitExecutionMode, getLegacyReportingName, getResourceLocksProviderEvaluator, getTags, getTestClass, getTestMethod, invokeTestWatchers, nodeSkipped, validateMethods inherited from class org.junit.jupiter.engine.descriptor.JupiterTestDescriptor
copyIncludingDescendants, getExclusiveResources, getExecutionMode, shouldBeSkipped, toExecutionModeMethods inherited from class org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
addChild, equals, findByUniqueId, getChildren, getDisplayName, getParent, getSource, getUniqueId, hashCode, orderChildren, removeChild, removeFromHierarchy, setParent, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.junit.platform.engine.support.hierarchical.Node
after, around, beforeMethods inherited from interface org.junit.platform.engine.TestDescriptor
accept, addChild, findByUniqueId, getAncestors, getChildren, getDescendants, getDisplayName, getParent, getSource, getUniqueId, isContainer, isRoot, isTest, mayRegisterTests, orderChildren, prune, removeChild, removeFromHierarchy, setParent
-
Field Details
-
SEGMENT_TYPE
- See Also:
-
-
Constructor Details
-
TestMethodTestDescriptor
-
-
Method Details
-
withUniqueId
protected TestMethodTestDescriptor withUniqueId(UnaryOperator<org.junit.platform.engine.UniqueId> uniqueIdTransformer) Description copied from class:JupiterTestDescriptorReturns shallow copy (without children) of this descriptor with the supplied unique ID.- Specified by:
withUniqueIdin classJupiterTestDescriptor- Returns:
- shallow copy (without children) of this descriptor with the supplied unique ID
-
getType
public org.junit.platform.engine.TestDescriptor.Type getType() -
prepare
Description copied from class:JupiterTestDescriptorMust be overridden and return a new context with a newExtensionContextso cleanUp() does not accidentally close the parent context.- Specified by:
preparein interfaceorg.junit.platform.engine.support.hierarchical.Node<JupiterEngineExecutionContext>- Specified by:
preparein classJupiterTestDescriptor
-
prepareExtensionContext
protected void prepareExtensionContext(org.junit.jupiter.api.extension.ExtensionContext extensionContext) -
populateNewExtensionRegistry
protected MutableExtensionRegistry populateNewExtensionRegistry(JupiterEngineExecutionContext context) -
execute
public JupiterEngineExecutionContext execute(JupiterEngineExecutionContext context, org.junit.platform.engine.support.hierarchical.Node.DynamicTestExecutor dynamicTestExecutor) -
cleanUp
- Specified by:
cleanUpin interfaceorg.junit.platform.engine.support.hierarchical.Node<JupiterEngineExecutionContext>- Overrides:
cleanUpin classJupiterTestDescriptor- Throws:
Exception
-
invokeTestMethod
protected void invokeTestMethod(JupiterEngineExecutionContext context, org.junit.platform.engine.support.hierarchical.Node.DynamicTestExecutor dynamicTestExecutor) -
nodeFinished
public void nodeFinished(JupiterEngineExecutionContext context, org.junit.platform.engine.TestDescriptor descriptor, org.junit.platform.engine.TestExecutionResult result) InvoketestSuccessful(),testAborted(), ortestFailed()on each registeredTestWatcheraccording to the status of the suppliedTestExecutionResult, in reverse registration order.- Since:
- 5.4
-
determineExclusiveResources
default Stream<org.junit.platform.engine.support.hierarchical.ExclusiveResource> determineExclusiveResources() -
determineOwnExclusiveResources
-