Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix programmatic extension registration for nested classes
Prior to this commit, extensions registered programmatically using the `RegisterExtension` annotation were added to the wrong extension registry multiple times for nested classes and their descendants. Instead of storing them in the registry on the same level as the test instance, they were always stored in the registry of the enclosing class. `TestInstancesProvider` now takes two arguments: An unmodifiable `ExtensionRegistry` that is used to instantiate and initialize the test instance and an extension registrar that is used to register additional extensions that are registered programmatically. Except for nested classes these are always the same. For nested classes, we need to ensure that extensions registered on their level and below are not used to initialize enclosing classes. Thus, the parent's registry is used for initialization but additional extensions from fields of the class are registered with the current registry (usually the registry of the test method, unless Lifecycle.PER_CLASS is used). Fixes #1925.
- Loading branch information
1 parent
c281338
commit 932ff16
Showing
18 changed files
with
383 additions
and
262 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
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.
932ff16
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍