Skip to content

Deprecate JUnit 4 utilities in the project #9996

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

Open
artembilan opened this issue Apr 27, 2025 · 4 comments
Open

Deprecate JUnit 4 utilities in the project #9996

artembilan opened this issue Apr 27, 2025 · 4 comments

Comments

@artembilan
Copy link
Member

Also, migrate JUnit 4 tests to Jupiter.
More info in: spring-projects/spring-framework#34794

@artembilan artembilan added this to the 7.0.0-M1 milestone Apr 27, 2025
@mjd507
Copy link
Contributor

mjd507 commented May 4, 2025

hello, @artembilan , I want to have a try on this.

but we have 42 modules in spring-integration, modifying all of them in one PR may take a long time.
can I do it by aggregating a few modules and raising PR accordingly?

@artembilan
Copy link
Member Author

Thanks for the offer, but not yet. We have to start 7.0 version first.

At the same time I don’t think there are a lot of JUnit 4 tests left to consider this task a huge.
Mostly we need to look into spring-integration-test-support and deprecate those JUnit 4 utils.

If you find any JUnit 4 tests, feel free to issue PR for them even right now. They are just tests, so they don’t affect production artifacts and that does not require a new version cut.

You may also look into migration of this into JUnit Jupiter: https://github.com/spring-projects/spring-integration/blob/main/spring-integration-ip/src/test/java/org/springframework/integration/ip/udp/MulticastRule.java.

There might be more I’m missing right now, but the point is: whatever is in test scope can migrate right now. If it is in main then it has to be deprecated first and only in the next 7.0 version.

@mjd507
Copy link
Contributor

mjd507 commented May 6, 2025

hello, @artembilan
I found very few test classes in spring-integration-core are using junit4 @RunWith(MockitoJUnitRunner.class) ,
e.g. org.springframework.integration.aggregator.MethodInvokingMessageGroupProcessorTests.
this MockitoJUnitRunner is in mockito-core,
however in Jupiter, the replacement MockitoExtension are in mockito-junit-jupiter which we are not included as a test dependency in our build.gradle.

do you think should we include this dependency for few test classes only? or we just replace @Mock object with new actual object.

@artembilan
Copy link
Member Author

do you think should we include this dependency for few test classes only?

I think something like MessageGroup messageGroupMock = mock(); should be enough for us instead of extra dependency just to satisfy some annotation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants