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

Stop sharing GenericConversionService between test methods #31291

Closed
wants to merge 1 commit into from

Conversation

quaff
Copy link
Contributor

@quaff quaff commented Sep 22, 2023

Some tests called mutating methods like addConverterFactory(), it will potentially affect other tests.

Some tests called mutating methods like addConverterFactory(), it will potentially affect other tests.
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 22, 2023
@BeforeEach
void init() {
conversionService = new GenericConversionService();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test class uses JUnit Jupiter with the default @TestInstance lifecycle mode which is PER_METHOD, meaning that the test instance will be instantiated for each test method.

Consequently, the GenericConversionService will be recreated for every instance/test.

@sbrannen
Copy link
Member

Closing as "works as designed".

See #31291 (review).

@sbrannen sbrannen closed this Sep 22, 2023
@sbrannen sbrannen added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 22, 2023
@sbrannen sbrannen changed the title Stop sharing conversionService between tests Stop sharing GenericConversionService between test methods Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants