-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit revises the @AutoClose support that was introduced in the previous commit as follows. - Javadoc and User Guide documentation for @AutoClose, now explicitly explain ordering, inheritance, evaluation order, scope, and lifecycle for @AutoClose fields. - Overhauled and simplified the implementation of the AutoCloseExtension by closing fields immediately instead of wrapping each field in a CloseableResource and storing it in the ExtensionContext.Store, and revised the implementation of preDestroyTestInstance() so that it makes use of TestInstancePreDestroyCallback.preDestroyTestInstances() to ensure proper semantics within @Nested test class hierarchies. Combined, these changes ensure that fields are closed in the proper order and that any resulting exceptions are thrown directly instead of nested as a cause of an exception that occurs when the ExtensionContext.Store is closed. - Improved diagnostics by failing eagerly if an @AutoClose annotation is declared with a blank close-method name or if the annotated field is a primitive type or array. - Since having the AutoCloseExtension in the org.junit.jupiter.api package introduced a cycle between the api and api.extension packages, the AutoCloseExtension now resides in the org.junit.jupiter.engine.extension package in junit-jupiter-engine and is loaded as a built-in extension. - The AutoCloseDemo now uses a WebClient that needs to be closed instead of a JDBC Connection, thereby avoiding the need to throw an SQLException and simplifying the example. - Overhauled AutoCloseTests to test all known use cases (including test class hierarchies and @Nested test class hierarchies) and error cases. Closes #3367 Closes #3592
- Loading branch information
Showing
14 changed files
with
566 additions
and
265 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
Oops, something went wrong.