spring-framework / org.springframework.test.context.junit4.rules / SpringMethodRule / apply

apply

open fun apply(base: Statement, frameworkMethod: FrameworkMethod, testInstance: Any): Statement

Apply instance-level and method-level features of the Spring TestContext Framework to the supplied base statement.

Specifically, this method invokes the prepareTestInstance(), beforeTestMethod(), and afterTestMethod() methods on the TestContextManager, potentially with Spring timeouts and repetitions.

In addition, this method checks whether the test is enabled in the current execution environment. This prevents methods with a non-matching @IfProfileValue annotation from running altogether, even skipping the execution of prepareTestInstance() methods in TestExecutionListeners.

Parameters

base - the base Statement that this rule should be applied to

frameworkMethod - the method which is about to be invoked on the test instance

testInstance - the current test instance

Return
a statement that wraps the supplied base with instance-level and method-level features of the Spring TestContext Framework

See Also
#withBeforeTestMethodCallbacks#withAfterTestMethodCallbacks#withPotentialRepeat#withPotentialTimeout#withTestInstancePreparation#withProfileValueCheck