Interface MethodInvoker
MethodInvoker defines a generic API for invoking a Method
 within the Spring TestContext Framework.
 Specifically, a MethodInvoker is made available to a
 TestExecutionListener via TestContext.getMethodInvoker(), and
 a TestExecutionListener can use the invoker to transparently benefit
 from any special method invocation features of the underlying testing framework.
 
For example, when the underlying testing framework is JUnit Jupiter, a
 TestExecutionListener can use a MethodInvoker to invoke
 arbitrary methods with JUnit Jupiter's
 parameter resolution
 mechanism. For other testing frameworks, the DEFAULT_INVOKER will be
 used.
- Since:
- 6.1
- Author:
- Sam Brannen
- See Also:
- 
- ExecutableInvoker
- MethodInvoker
 
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final MethodInvokerShared instance of the defaultMethodInvoker.
- 
Method Summary
- 
Field Details- 
DEFAULT_INVOKERShared instance of the defaultMethodInvoker.This invoker never provides arguments to a Method.
 
- 
- 
Method Details- 
invokeInvoke the suppliedMethodon the suppliedtarget.When the DEFAULT_INVOKERis used — for example, when the underlying testing framework is JUnit 4 or TestNG — the method must not declare any formal parameters. When the underlying testing framework is JUnit Jupiter, parameters will be dynamically resolved via registeredParameterResolvers(such as theSpringExtension).- Parameters:
- method- the method to invoke
- target- the object on which to invoke the method, may be- nullif the method is- static
- Returns:
- the value returned from the method invocation, potentially null
- Throws:
- Exception- if any error occurs
 
 
-