-
Notifications
You must be signed in to change notification settings - Fork 23
Migrate Junit4to5 #646
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
Migrate Junit4to5 #646
Conversation
…atorMojoTest, adding MojoInits for namingSTrategy and annotationStrategy
…eratorMojoTest, adding MojoInits for namingSTrategy and annotationStrategy
…eratorMojoIntegrationTest, adding MojoInits for verbose, copyrightHeader and skip
…eratorMojoUnitTest, adding MojoInits for sapCopyrightHeader
|
Hi @aamotharald, thanks for your contribution! Unfortunately, this approach doesn't work, because the Aside from that, I don't understand why the resilience tests got changed, they are already using JUnit 5 and thus should have remain unchanged? Finally, maybe you can split out the improvements to productive code, then it'll be much easier to understand them + the related test changes, compared to JUnit related test changes. |
|
Hi @MatKuhr , still formatting .. I see so the maven-plugin-testing-harness pulls in JUnit4. At least with this restructuring once the testing-harness starts to support JUnit5 the switch will be done directly as I got rid of the JUnit4 rules which are not supported anymore in JUnit5 . |
… why does the formatter plugin not sort????)
|
Hi @MatKuhr ,
The only advantage I see in this change here is that junit4 does not get pulled explicitly, but transitively. |
|
Seems like maven-plugin-testing-harness 4.x.x is going for JUnit5 support with a JUnit5 Extension instead of inheriting from a base class.
Hence once we have a non-beta 4.0.0 release the tests would have to get refactored accordingly anyhow :-( |
|
Hi @MatKuhr , I did some more research and think it makes sense to close my PR. I have requested in ths ASF JIRA to have the testing-harness 3.3.4 released which offers JUnit5 support. Then the plugin testing could be done like this: What do you think? |
|
Thanks for requesting the update! Yeah, I think that would be the best solution for us 👍🏻 Then we can simply get rid of the current workaround and fully remove junit4 from our dependency tree. Since you have access to that project, could you maybe ping here / re-open this PR once the update is available? Otherwise our dependabot should also catch the update eventually |


Hi @MatKuhr
I performed a migration from JUnit4 to jUnit5 to get rid of any legacy / technical debt with regards to the testing framework.
I used an automated migration tool (OpenRewrite) and then had to deal manually with a @nested test and the tests for the maven plugin mojos.
Documentation updatedPlease review CAREFULLY the changes made to the Mojo's which is actually a change in the production code to make the mojo tests pass with the JUnit5 approach.
All other changes are test code changes by keeping scope and the number of tests exactly the same. I was even able to enable a test that was deactivated before.