public interface ApplicationEvents
ApplicationEvents encapsulates all application events that were fired during the execution of a single test method.
To use ApplicationEvents in your tests, do the following.
@RecordApplicationEvents.ApplicationEventsTestExecutionListener is
registered. Note, however, that it is registered by default and only needs
to be manually registered if you have custom configuration via
@TestExecutionListeners
that does not include the default listeners.ApplicationEvents with
@Autowired and
use that instance of ApplicationEvents in your test and lifecycle methods.ApplicationEvents in a test or lifecycle method as an alternative to
an @Autowired field in the test class.RecordApplicationEvents,
ApplicationEventsTestExecutionListener,
ApplicationEvent| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear all application events recorded by this
ApplicationEvents instance. |
Stream<ApplicationEvent> |
stream()
Stream all application events that were fired during test execution.
|
<T> Stream<T> |
stream(Class<T> type)
Stream all application events or event payloads of the given type that
were fired during test execution.
|
Stream<ApplicationEvent> stream()
stream(Class),
clear()<T> Stream<T> stream(Class<T> type)
void clear()
ApplicationEvents instance.
Subsequent calls to stream() or stream(Class) will
only include events recorded since this method was invoked.
stream(),
stream(Class)