@API(status=INTERNAL, since="5.0") public class TestMethodTestDescriptor extends MethodBasedTestDescriptor
TestDescriptor
for @Test
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) { ... }
Modifier and Type | Class and Description |
---|---|
private static interface |
TestMethodTestDescriptor.CallbackInvoker<T extends Extension> |
JupiterTestDescriptor.ExceptionHandlerInvoker<E extends Extension>
Node.DynamicTestExecutor, Node.ExecutionMode, Node.Invocation<C extends EngineExecutionContext>, Node.SkipResult
TestDescriptor.Type, TestDescriptor.Visitor
Modifier and Type | Field and Description |
---|---|
private static ExecutableInvoker.ReflectiveInterceptorCall<java.lang.reflect.Method,java.lang.Void> |
defaultInterceptorCall |
private static ExecutableInvoker |
executableInvoker |
private ExecutableInvoker.ReflectiveInterceptorCall<java.lang.reflect.Method,java.lang.Void> |
interceptorCall |
private static Logger |
logger |
static java.lang.String |
SEGMENT_TYPE |
configuration
children
Constructor and Description |
---|
TestMethodTestDescriptor(UniqueId uniqueId,
java.lang.Class<?> testClass,
java.lang.reflect.Method testMethod,
JupiterConfiguration configuration) |
TestMethodTestDescriptor(UniqueId uniqueId,
java.lang.String displayName,
java.lang.Class<?> testClass,
java.lang.reflect.Method testMethod,
JupiterConfiguration configuration,
ExecutableInvoker.ReflectiveInterceptorCall<java.lang.reflect.Method,java.lang.Void> interceptorCall) |
getExclusiveResources, getExplicitExecutionMode, getLegacyReportingName, getTags, getTestClass, getTestMethod
cleanUp, getDefaultChildExecutionMode, getExclusiveResourcesFromAnnotation, getExecutionMode, getExecutionModeFromAnnotation, getTags, invokeExecutionExceptionHandlers, shouldBeSkipped, toExecutionMode
addChild, equals, findByUniqueId, getChildren, getDisplayName, getParent, getSource, getUniqueId, hashCode, removeChild, removeFromHierarchy, setParent, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
after, around, before
accept, containsTests, getDescendants, isContainer, isRoot, isTest, mayRegisterTests, prune
public static final java.lang.String SEGMENT_TYPE
private static final ExecutableInvoker executableInvoker
private static final Logger logger
private static final ExecutableInvoker.ReflectiveInterceptorCall<java.lang.reflect.Method,java.lang.Void> defaultInterceptorCall
private final ExecutableInvoker.ReflectiveInterceptorCall<java.lang.reflect.Method,java.lang.Void> interceptorCall
public TestMethodTestDescriptor(UniqueId uniqueId, java.lang.Class<?> testClass, java.lang.reflect.Method testMethod, JupiterConfiguration configuration)
TestMethodTestDescriptor(UniqueId uniqueId, java.lang.String displayName, java.lang.Class<?> testClass, java.lang.reflect.Method testMethod, JupiterConfiguration configuration, ExecutableInvoker.ReflectiveInterceptorCall<java.lang.reflect.Method,java.lang.Void> interceptorCall)
public TestDescriptor.Type getType()
TestDescriptor
TestDescriptor.Type
of this descriptor.null
.TestDescriptor.isContainer()
,
TestDescriptor.isTest()
public JupiterEngineExecutionContext prepare(JupiterEngineExecutionContext context)
JupiterTestDescriptor
prepare
in interface Node<JupiterEngineExecutionContext>
prepare
in class JupiterTestDescriptor
Node.cleanUp(EngineExecutionContext)
protected MutableExtensionRegistry populateNewExtensionRegistry(JupiterEngineExecutionContext context)
public JupiterEngineExecutionContext execute(JupiterEngineExecutionContext context, Node.DynamicTestExecutor dynamicTestExecutor) throws java.lang.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.
The default implementation returns the supplied context
unmodified.
context
- the context to execute indynamicTestExecutor
- the executor to submit dynamic tests tojava.lang.Exception
Node.before(C)
,
Node.after(C)
private boolean isPerMethodLifecycle(JupiterEngineExecutionContext context)
private void invokeBeforeEachCallbacks(JupiterEngineExecutionContext context)
private void invokeBeforeEachMethods(JupiterEngineExecutionContext context)
private void invokeBeforeEachExecutionExceptionHandlers(ExtensionContext context, ExtensionRegistry registry, java.lang.Throwable throwable)
private void invokeBeforeTestExecutionCallbacks(JupiterEngineExecutionContext context)
private <T extends Extension> void invokeBeforeMethodsOrCallbacksUntilExceptionOccurs(java.lang.Class<T> type, JupiterEngineExecutionContext context, TestMethodTestDescriptor.CallbackInvoker<T> callbackInvoker)
protected void invokeTestMethod(JupiterEngineExecutionContext context, Node.DynamicTestExecutor dynamicTestExecutor)
private void invokeTestExecutionExceptionHandlers(ExtensionRegistry registry, ExtensionContext context, java.lang.Throwable throwable)
private void invokeAfterTestExecutionCallbacks(JupiterEngineExecutionContext context)
private void invokeAfterEachMethods(JupiterEngineExecutionContext context)
private void invokeAfterEachExecutionExceptionHandlers(ExtensionContext context, ExtensionRegistry registry, java.lang.Throwable throwable)
private void invokeAfterEachCallbacks(JupiterEngineExecutionContext context)
private void invokeTestInstancePreDestroyCallbacks(JupiterEngineExecutionContext context)
private <T extends Extension> void invokeAllAfterMethodsOrCallbacks(java.lang.Class<T> type, JupiterEngineExecutionContext context, TestMethodTestDescriptor.CallbackInvoker<T> callbackInvoker)
public void nodeSkipped(JupiterEngineExecutionContext context, TestDescriptor descriptor, Node.SkipResult result)
TestWatcher.testDisabled(ExtensionContext, Optional)
on each
registered TestWatcher
, in registration order.context
- the execution contextdescriptor
- the test descriptor that was skippedresult
- the result of skipped executionpublic void nodeFinished(JupiterEngineExecutionContext context, TestDescriptor descriptor, TestExecutionResult result)
testSuccessful()
,
testAborted()
, or
testFailed()
on each
registered TestWatcher
according to the status of the supplied
TestExecutionResult
, in reverse registration order.context
- the execution contextdescriptor
- the test descriptor that was executedresult
- the result of the executionprivate void invokeTestWatchers(JupiterEngineExecutionContext context, boolean reverseOrder, java.util.function.Consumer<TestWatcher> callback)