public class ApplicationEventsTestExecutionListener extends AbstractTestExecutionListener
TestExecutionListener which provides support for ApplicationEvents.
This listener manages the registration of ApplicationEvents for the
current thread at various points within the test execution lifecycle and makes
the current instance of ApplicationEvents available to tests via an
@Autowired
field in the test class.
If the test class is not annotated or meta-annotated with
@RecordApplicationEvents, this listener
effectively does nothing.
ApplicationEvents,
ApplicationEventsHolder| Constructor and Description |
|---|
ApplicationEventsTestExecutionListener() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterTestMethod(TestContext testContext)
The default implementation is empty.
|
void |
beforeTestMethod(TestContext testContext)
The default implementation is empty.
|
int |
getOrder()
Returns
1800. |
void |
prepareTestInstance(TestContext testContext)
The default implementation is empty.
|
afterTestClass, afterTestExecution, beforeTestClass, beforeTestExecutionpublic ApplicationEventsTestExecutionListener()
public final int getOrder()
1800.getOrder in interface org.springframework.core.OrderedgetOrder in class AbstractTestExecutionListenerpublic void prepareTestInstance(TestContext testContext) throws Exception
AbstractTestExecutionListenerprepareTestInstance in interface TestExecutionListenerprepareTestInstance in class AbstractTestExecutionListenertestContext - the test context for the test; never nullException - allows any exception to propagatepublic void beforeTestMethod(TestContext testContext) throws Exception
AbstractTestExecutionListenerbeforeTestMethod in interface TestExecutionListenerbeforeTestMethod in class AbstractTestExecutionListenertestContext - the test context in which the test method will be
executed; never nullException - allows any exception to propagateTestExecutionListener.afterTestMethod(org.springframework.test.context.TestContext),
TestExecutionListener.beforeTestExecution(org.springframework.test.context.TestContext),
TestExecutionListener.afterTestExecution(org.springframework.test.context.TestContext)public void afterTestMethod(TestContext testContext) throws Exception
AbstractTestExecutionListenerafterTestMethod in interface TestExecutionListenerafterTestMethod in class AbstractTestExecutionListenertestContext - the test context in which the test method was
executed; never nullException - allows any exception to propagateTestExecutionListener.beforeTestMethod(org.springframework.test.context.TestContext),
TestExecutionListener.beforeTestExecution(org.springframework.test.context.TestContext),
TestExecutionListener.afterTestExecution(org.springframework.test.context.TestContext)