Class ApplicationEventsTestExecutionListener
java.lang.Object
org.springframework.test.context.support.AbstractTestExecutionListener
org.springframework.test.context.event.ApplicationEventsTestExecutionListener
- All Implemented Interfaces:
Ordered,TestExecutionListener
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.
- Since:
- 5.3.3
- Author:
- Sam Brannen
- See Also:
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterTestMethod(TestContext testContext) The default implementation is empty.voidbeforeTestMethod(TestContext testContext) The default implementation is empty.final intgetOrder()Returns1800.voidprepareTestInstance(TestContext testContext) The default implementation is empty.Methods inherited from class org.springframework.test.context.support.AbstractTestExecutionListener
afterTestClass, afterTestExecution, beforeTestClass, beforeTestExecution
-
Constructor Details
-
ApplicationEventsTestExecutionListener
public ApplicationEventsTestExecutionListener()
-
-
Method Details
-
getOrder
public final int getOrder()Returns1800.- Specified by:
getOrderin interfaceOrdered- Overrides:
getOrderin classAbstractTestExecutionListener- Returns:
- the order value
- See Also:
-
prepareTestInstance
Description copied from class:AbstractTestExecutionListenerThe default implementation is empty. Can be overridden by subclasses as necessary.- Specified by:
prepareTestInstancein interfaceTestExecutionListener- Overrides:
prepareTestInstancein classAbstractTestExecutionListener- Parameters:
testContext- the test context for the test; nevernull- Throws:
Exception- allows any exception to propagate
-
beforeTestMethod
Description copied from class:AbstractTestExecutionListenerThe default implementation is empty. Can be overridden by subclasses as necessary.- Specified by:
beforeTestMethodin interfaceTestExecutionListener- Overrides:
beforeTestMethodin classAbstractTestExecutionListener- Parameters:
testContext- the test context in which the test method will be executed; nevernull- Throws:
Exception- allows any exception to propagate- See Also:
-
afterTestMethod
Description copied from class:AbstractTestExecutionListenerThe default implementation is empty. Can be overridden by subclasses as necessary.- Specified by:
afterTestMethodin interfaceTestExecutionListener- Overrides:
afterTestMethodin classAbstractTestExecutionListener- Parameters:
testContext- the test context in which the test method was executed; nevernull- Throws:
Exception- allows any exception to propagate- See Also:
-