Class ApplicationEventsHolder
java.lang.Object
org.springframework.test.context.event.ApplicationEventsHolder
Holder class to expose the application events published during the execution
 of a test in the form of a thread-bound 
ApplicationEvents object.
 ApplicationEvents are registered in this holder and managed by
 the ApplicationEventsTestExecutionListener.
 
Although this class is public, it is only intended for use within
 the Spring TestContext Framework or in the implementation of
 third-party extensions. Test authors should therefore allow the current
 instance of ApplicationEvents to be
 @Autowired
 into a field in the test class or injected via a parameter in test and
 lifecycle methods when using JUnit Jupiter and the SpringExtension.
- Since:
- 5.3.3
- Author:
- Sam Brannen, Oliver Drotbohm
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptionstatic ApplicationEventsGet theApplicationEventsfor the current thread.static ApplicationEventsGet theApplicationEventsfor the current thread.
- 
Method Details- 
getApplicationEventsGet theApplicationEventsfor the current thread.- Returns:
- the current ApplicationEvents, ornullif not registered
 
- 
getRequiredApplicationEventsGet theApplicationEventsfor the current thread.- Returns:
- the current ApplicationEvents
- Throws:
- IllegalStateException- if an instance of- ApplicationEventshas not been registered for the current thread
 
 
-