Interface ApplicationEvents
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.
 
- Ensure that your test class is annotated or meta-annotated with
 
@RecordApplicationEvents. - Ensure that the 
ApplicationEventsTestExecutionListeneris registered. Note, however, that it is registered by default and only needs to be manually registered if you have custom configuration via@TestExecutionListenersthat does not include the default listeners. - Annotate a field of type 
ApplicationEventswith@Autowiredand use that instance ofApplicationEventsin your test and lifecycle methods. - With JUnit Jupiter, you may optionally declare a parameter of type
 
ApplicationEventsin a test or lifecycle method as an alternative to an@Autowiredfield in the test class. 
- Since:
 - 5.3.3
 - Author:
 - Sam Brannen, Oliver Drotbohm
 - See Also:
 
- 
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear all application events recorded by thisApplicationEventsinstance.stream()Stream all application events that were fired during test execution.<T> Stream<T> Stream all application events or event payloads of the given type that were fired during test execution. 
- 
Method Details
- 
stream
Stream<ApplicationEvent> stream()Stream all application events that were fired during test execution.- Returns:
 - a stream of all application events
 - See Also:
 
 - 
stream
Stream all application events or event payloads of the given type that were fired during test execution.- Type Parameters:
 T- the event type- Parameters:
 type- the type of events or payloads to stream; nevernull- Returns:
 - a stream of all application events or event payloads of the specified type
 - See Also:
 
 - 
clear
void clear()Clear all application events recorded by thisApplicationEventsinstance.Subsequent calls to
stream()orstream(Class)will only include events recorded since this method was invoked.- See Also:
 
 
 -