@API(value=Internal) public class MethodTestDescriptor extends JupiterTestDescriptor
TestDescriptor
for tests based on Java methods.
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) { ... }
Node.DynamicTestExecutor, Node.SkipResult
TestDescriptor.Type, TestDescriptor.Visitor
Constructor and Description |
---|
MethodTestDescriptor(UniqueId uniqueId,
Class<?> testClass,
Method testMethod) |
Modifier and Type | Method and Description |
---|---|
JupiterEngineExecutionContext |
execute(JupiterEngineExecutionContext context,
Node.DynamicTestExecutor dynamicTestExecutor)
Execute the behavior of this node.
|
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() |
Method |
getTestMethod() |
TestDescriptor.Type |
getType()
Determine the
TestDescriptor.Type of this descriptor. |
protected void |
invokeTestMethod(JupiterEngineExecutionContext context,
Node.DynamicTestExecutor dynamicTestExecutor) |
protected ExtensionRegistry |
populateNewExtensionRegistry(JupiterEngineExecutionContext context) |
JupiterEngineExecutionContext |
prepare(JupiterEngineExecutionContext context)
Prepare the supplied
context prior to execution. |
Node.SkipResult |
shouldBeSkipped(JupiterEngineExecutionContext context)
Determine if the execution of the supplied
context should be
skipped. |
determineDisplayName, executeAndMaskThrowable, getTags, isLeaf, populateNewExtensionRegistryFromExtendWith, shouldContainerBeSkipped, shouldTestBeSkipped
addChild, equals, findByUniqueId, getChildren, getDisplayName, getParent, getSource, getUniqueId, hashCode, removeChild, removeFromHierarchy, setParent, setSource, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
after, before, execute
accept, getDescendants, hasTests, isContainer, isRoot, isTest, prune, pruneTree
public TestDescriptor.Type getType()
TestDescriptor
TestDescriptor.Type
of this descriptor.null
.TestDescriptor.isContainer()
,
TestDescriptor.isTest()
public JupiterEngineExecutionContext prepare(JupiterEngineExecutionContext context) throws Exception
Node
context
prior to execution.
The default implementation returns the supplied context
unmodified.
Exception
protected ExtensionRegistry populateNewExtensionRegistry(JupiterEngineExecutionContext context)
public Node.SkipResult shouldBeSkipped(JupiterEngineExecutionContext context) throws Exception
Node
context
should be
skipped.
The default implementation returns Node.SkipResult.doNotSkip()
.
Exception
public JupiterEngineExecutionContext execute(JupiterEngineExecutionContext context, Node.DynamicTestExecutor dynamicTestExecutor) throws Exception
Node
Containers typically do not implement this method since the
HierarchicalTestEngine
handles execution of their children.
The supplied dynamicTestExecutor
may be used to submit
additional dynamic tests for immediate execution.
context
- the context to execute indynamicTestExecutor
- the executor to submit dynamic tests toException
Node.before(C)
,
Node.after(C)
protected void invokeTestMethod(JupiterEngineExecutionContext context, Node.DynamicTestExecutor dynamicTestExecutor)
public final Set<TestTag> getTags()
TestDescriptor
getTags
in interface TestDescriptor
getTags
in class AbstractTestDescriptor
null
but potentially emptyTestTag
public final Class<?> getTestClass()
public final Method getTestMethod()
public String getLegacyReportingName()
TestDescriptor
The default implementation simply delegates to TestDescriptor.getDisplayName()
.
null
or blank