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:
 - 
ExecutableInvokerMethodInvoker
 
- 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MethodInvokerShared instance of the defaultMethodInvoker. - 
Method Summary
 
- 
Field Details
- 
DEFAULT_INVOKER
Shared instance of the defaultMethodInvoker.This invoker never provides arguments to a
Method. 
 - 
 - 
Method Details
- 
invoke
Invoke 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 invoketarget- the object on which to invoke the method, may benullif the method isstatic- Returns:
 - the value returned from the method invocation, potentially 
null - Throws:
 Exception- if any error occurs
 
 -