Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process extensions registered on non-static fields earlier #3895

Merged
merged 29 commits into from
Jul 30, 2024

Conversation

marcphilipp
Copy link
Member

@marcphilipp marcphilipp commented Jul 22, 2024

Overview

This PR changes extensions declared via @ExtendWith on non-static fields to be registered before the test instance is instantiated. Since these declarative extensions are documented to be sorted along with programmatic extensions registered via @RegisterExtension the latter are also registered earlier. Since, however, non-static fields are not initialized until the test class is instantiated, this PR introduces the internal concept of "uninitialized extensions" that are registered early and initialized whenever an instance of the test class is created.

Fixes #3437. Resolves #3463.


I hereby agree to the terms of the JUnit Contributor License Agreement.


Definition of Done

@marcphilipp marcphilipp self-assigned this Jul 22, 2024
@marcphilipp marcphilipp changed the title Issues/3437 extend with on fields early registration Process extensions registered on non-static fields before test class instantiation Jul 22, 2024
@marcphilipp marcphilipp force-pushed the issues/3437-ExtendWith-on-fields-early-registration branch from da0679f to 9b5a86a Compare July 23, 2024 14:10
@marcphilipp marcphilipp force-pushed the issues/3437-ExtendWith-on-fields-early-registration branch from 9b5a86a to 305eaf4 Compare July 23, 2024 15:27
@marcphilipp marcphilipp changed the title Process extensions registered on non-static fields before test class instantiation Process extensions registered on non-static fields earlier Jul 30, 2024
@marcphilipp marcphilipp merged commit f8a65af into main Jul 30, 2024
16 checks passed
@marcphilipp marcphilipp deleted the issues/3437-ExtendWith-on-fields-early-registration branch July 30, 2024 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants