Introduce MethodInvoker
API for TestExecutionListener
s
#31199
Labels
Milestone
MethodInvoker
API for TestExecutionListener
s
#31199
Uh oh!
There was an error while loading. Please reload this page.
Overview
In order to be able to support parameter injection in
@BeforeTransaction
and@AfterTransaction
methods (see #30736), we need a generic mechanism for delegating to the underlying testing framework to invoke methods.While we're at it, we could do the same for constructors, but I'm hesitant to add a feature that
TestExecutionListener
authors will never actually need.In light of that, we should introduce an
MethodInvoker
API forTestExecutionListener
s in the Spring TestContext Framework.The default implementation should simply invoke the method without arguments.
A JUnit Jupiter specific implementation (registered in the
SpringExtension
) should delegate to theorg.junit.jupiter.api.extension.ExtensionContext.getExecutableInvoker()
mechanism introduced in JUnit Jupiter 5.9. This will allow aTestExecutionListener
to transparently benefit from registeredParameterResolver
s in JUnit Jupiter (including theSpringExtension
) when invoking user methods, effectively providing support for parameter injection for arbitrary methods.Related Issues
@BeforeTransaction
/@AfterTransaction
methods #30736The text was updated successfully, but these errors were encountered: