@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.SkipResult
TestDescriptor.Visitor
Constructor and Description |
---|
MethodTestDescriptor(UniqueId uniqueId,
Class<?> testClass,
Method testMethod) |
Modifier and Type | Method and Description |
---|---|
JupiterEngineExecutionContext |
execute(JupiterEngineExecutionContext context)
Execute the behavior of this node.
|
protected static String |
generateDefaultDisplayName(Method testMethod) |
Set<TestTag> |
getTags()
Get the set of tags associated with this descriptor.
|
Class<?> |
getTestClass() |
Method |
getTestMethod() |
protected void |
invokeTestMethod(JupiterEngineExecutionContext context) |
boolean |
isContainer()
Determine if this descriptor describes a container.
|
boolean |
isTest()
Determine if this descriptor describes a test.
|
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
addChild, equals, findByUniqueId, getChildren, getDisplayName, getParent, getSource, getUniqueId, hashCode, removeChild, removeFromHierarchy, setParent, setSource, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
accept, getDescendants, hasTests, isRoot
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 boolean isTest()
TestDescriptor
public boolean isContainer()
TestDescriptor
public JupiterEngineExecutionContext prepare(JupiterEngineExecutionContext context) throws Exception
Node
context
prior to execution.
The default implementation returns the supplied context
unmodified.
Exception
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) throws Exception
Node
Containers typically do not implement this method since the
HierarchicalTestEngine
handles execution of their children.
context
- the context to execute inException
Node.before(C)
,
Node.after(C)
protected void invokeTestMethod(JupiterEngineExecutionContext context)