Class TestMethodTestDescriptor
- java.lang.Object
-
- org.junit.platform.engine.support.descriptor.AbstractTestDescriptor
-
- org.junit.jupiter.engine.descriptor.JupiterTestDescriptor
-
- org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor
-
- All Implemented Interfaces:
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 JupiterTestDescriptor
TestDescriptor
for tests based on Java 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 istestUser(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.SkipResult
-
-
Constructor Summary
Constructors Constructor Description TestMethodTestDescriptor(org.junit.platform.engine.UniqueId uniqueId, java.lang.Class<?> testClass, java.lang.reflect.Method testMethod)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JupiterEngineExecutionContext
execute(JupiterEngineExecutionContext context, org.junit.platform.engine.support.hierarchical.Node.DynamicTestExecutor dynamicTestExecutor)
java.util.Set<org.junit.platform.engine.support.hierarchical.ExclusiveResource>
getExclusiveResources()
protected java.util.Optional<org.junit.platform.engine.support.hierarchical.Node.ExecutionMode>
getExplicitExecutionMode()
java.lang.String
getLegacyReportingName()
java.util.Set<org.junit.platform.engine.TestTag>
getTags()
java.lang.Class<?>
getTestClass()
java.lang.reflect.Method
getTestMethod()
org.junit.platform.engine.TestDescriptor.Type
getType()
protected void
invokeTestMethod(JupiterEngineExecutionContext context, org.junit.platform.engine.support.hierarchical.Node.DynamicTestExecutor dynamicTestExecutor)
protected ExtensionRegistry
populateNewExtensionRegistry(JupiterEngineExecutionContext context)
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, getDefaultChildExecutionMode, getExclusiveResourcesFromAnnotation, getExecutionMode, getExecutionModeFromAnnotation, getTags, shouldBeSkipped
-
-
-
-
Method Detail
-
getType
public org.junit.platform.engine.TestDescriptor.Type getType()
-
prepare
public JupiterEngineExecutionContext prepare(JupiterEngineExecutionContext context) throws java.lang.Exception
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 interfaceorg.junit.platform.engine.support.hierarchical.Node<JupiterEngineExecutionContext>
- Specified by:
prepare
in classJupiterTestDescriptor
- Throws:
java.lang.Exception
-
populateNewExtensionRegistry
protected ExtensionRegistry populateNewExtensionRegistry(JupiterEngineExecutionContext context)
-
execute
public JupiterEngineExecutionContext execute(JupiterEngineExecutionContext context, org.junit.platform.engine.support.hierarchical.Node.DynamicTestExecutor dynamicTestExecutor) throws java.lang.Exception
- Throws:
java.lang.Exception
-
invokeTestMethod
protected void invokeTestMethod(JupiterEngineExecutionContext context, org.junit.platform.engine.support.hierarchical.Node.DynamicTestExecutor dynamicTestExecutor)
-
getTags
public final java.util.Set<org.junit.platform.engine.TestTag> getTags()
- Specified by:
getTags
in interfaceorg.junit.platform.engine.TestDescriptor
- Overrides:
getTags
in classorg.junit.platform.engine.support.descriptor.AbstractTestDescriptor
-
getExclusiveResources
public java.util.Set<org.junit.platform.engine.support.hierarchical.ExclusiveResource> getExclusiveResources()
-
getExplicitExecutionMode
protected java.util.Optional<org.junit.platform.engine.support.hierarchical.Node.ExecutionMode> getExplicitExecutionMode()
- Overrides:
getExplicitExecutionMode
in classJupiterTestDescriptor
-
getTestClass
public final java.lang.Class<?> getTestClass()
-
getTestMethod
public final java.lang.reflect.Method getTestMethod()
-
getLegacyReportingName
public java.lang.String getLegacyReportingName()
-
-