@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,
java.lang.Class<?> testClass,
java.lang.reflect.Method testMethod) |
Modifier and Type | Method and Description |
---|---|
JupiterEngineExecutionContext |
execute(JupiterEngineExecutionContext context)
Execute the behavior of this node.
|
protected static java.lang.String |
generateDefaultDisplayName(java.lang.reflect.Method testMethod) |
java.util.Set<TestTag> |
getTags()
Get the set of tags associated with this descriptor.
|
java.lang.Class<?> |
getTestClass() |
java.lang.reflect.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, getAllDescendants, hasTests, isRoot
public MethodTestDescriptor(UniqueId uniqueId, java.lang.Class<?> testClass, java.lang.reflect.Method testMethod)
public final 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 final java.lang.reflect.Method getTestMethod()
public boolean isTest()
TestDescriptor
public boolean isContainer()
TestDescriptor
protected static java.lang.String generateDefaultDisplayName(java.lang.reflect.Method testMethod)
public JupiterEngineExecutionContext prepare(JupiterEngineExecutionContext context) throws java.lang.Exception
Node
context
prior to execution.
The default implementation returns the supplied context
unmodified.
java.lang.Exception
public Node.SkipResult shouldBeSkipped(JupiterEngineExecutionContext context) throws java.lang.Exception
Node
context
should be
skipped.
The default implementation returns Node.SkipResult.doNotSkip()
.
java.lang.Exception
public JupiterEngineExecutionContext execute(JupiterEngineExecutionContext context) throws java.lang.Exception
Node
Containers typically do not implement this method since the
HierarchicalTestEngine
handles execution of their children.
context
- the context to execute injava.lang.Exception
Node.before(C)
,
Node.after(C)
protected void invokeTestMethod(JupiterEngineExecutionContext context)