Migrate the AbstractIT-based integration test classes to JUnit 5 - #294
Merged
Conversation
Convert the 9 JUnit 4 IT*.java classes (run by maven-failsafe-plugin under the run-its profile) and their AbstractIT base class from org.junit to org.junit.jupiter.api: @test, @before -> @beforeeach, static Assert.* -> Assertions.*, Assume.assumeTrue -> Assumptions.assumeTrue. Add org.junit.jupiter:junit-jupiter-api as a direct test dependency (the version is managed by the parent) and org.junit.vintage:junit-vintage-engine so the still-JUnit-3-style RemoteResourcesMojoTest (extends the deprecated AbstractMojoTestCase/PlexusTestCase) keeps running under the JUnit Platform. junit:junit is kept for the same reason. Both are excluded from the maven-dependency-plugin analyze-only check since they are only picked up via reflection/ServiceLoader, not direct bytecode references. RemoteResourcesMojoTest itself is intentionally left on the deprecated AbstractMojoTestCase: a JUnit 5 path exists via maven-plugin-testing-harness's @MojoTest/@InjectMojo/@MojoParameter annotations, but this test's imperative, dynamically-configured mojo lookups do not map onto that declarative model without a substantial redesign, so it is left as a follow-up. Generated-by: Claude Opus 5 (1M context)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves the 10
AbstractIT-derived test classes undersrc/test/java/.../it/(run by failsafe under therun-itsprofile) from JUnit 4 to Jupiter:@Before→@BeforeEach,Assert.*→Assertions.*,Assume.assumeTrue→Assumptions.assumeTrue. No assertion in this module passed a message, so there was no argument-order flip to get wrong.src/it/**is untouched — that is a separate maven-invoker-plugin sample-project tree, not this suite.Deliberately not migrated:
RemoteResourcesMojoTest. It extendsAbstractMojoTestCase→PlexusTestCase(JUnit 3 style,testXxx()methods). maven-plugin-testing-harness 3.5.1 does ship a JUnit 5 path (@MojoTest/@InjectMojo/@MojoParameter), so this is not a blocked dependency — but this test builds differently-configured mojo instances per test vialookupMojo()+setVariableValueToObject()with runtime-computed session and repository state, which does not map onto that declarative model without a real redesign. That is out of scope for a mechanical migration and wants its own change.Because that class stays,
junit:junitstays too, andjunit-vintage-engineis added so it remains discoverable once surefire switches toJUnitPlatformProvider. Both are added to the existinganalyze-onlyignoredDependencies, since they are reached by ServiceLoader rather than by bytecode reference andfailOnWarningis on.Verification
mvn testbefore and after:Tests run: 10, Failures: 0, Errors: 0, Skipped: 0.mvn -Prun-its verifybefore and after: surefire 10/10, failsafe 9/9, identical. That run also shows 5 pre-existing failures in thesrc/itinvoker projects (a Groovy verify-script resolution error) which are present onmastertoo and are unrelated to this change.Draft until CI confirms.
Generated-by: Claude Opus 5 (1M context)