-
Notifications
You must be signed in to change notification settings - Fork 38.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test support to record async events, with Junit5 caveat
This commit modifies the way the `@RecordApplicationEvents` annotation works in tests, allowing for capture of events from threads other than the main test thread (async events) and for the assertion of captured event from a separate thread (e.g. when using `Awaitility`). This is done by switching the `ApplicationEventsHolder` to use an `InheritedThreadLocal`. There is a mutual exclusion between support of asynchronous events vs support of JUnit5 parallel tests with the `@TestInstance(PER_CLASS)` mode. As a result, we favor the former and now `SpringExtension` will invalidate a test class that is annotated (or meta-annotated, or enclosed-annotated) with `@RecordApplicationEvents` AND `@TestInstance(PER_CLASS)` AND `@Execution(CONCURRENT)`. See gh-29827 Closes gh-30020
- Loading branch information
1 parent
906c54f
commit b39e93d
Showing
8 changed files
with
339 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.