Skip to content

Migrate the AbstractIT-based integration test classes to JUnit 5 - #294

Merged
slachiewicz merged 1 commit into
masterfrom
agent/junit5-remote-resources-plugin
Aug 9, 2026
Merged

Migrate the AbstractIT-based integration test classes to JUnit 5#294
slachiewicz merged 1 commit into
masterfrom
agent/junit5-remote-resources-plugin

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

Moves the 10 AbstractIT-derived test classes under src/test/java/.../it/ (run by failsafe under the run-its profile) from JUnit 4 to Jupiter: @Before@BeforeEach, Assert.*Assertions.*, Assume.assumeTrueAssumptions.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 extends AbstractMojoTestCasePlexusTestCase (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 via lookupMojo() + 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:junit stays too, and junit-vintage-engine is added so it remains discoverable once surefire switches to JUnitPlatformProvider. Both are added to the existing analyze-only ignoredDependencies, since they are reached by ServiceLoader rather than by bytecode reference and failOnWarning is on.

Verification

mvn test before and after: Tests run: 10, Failures: 0, Errors: 0, Skipped: 0.
mvn -Prun-its verify before and after: surefire 10/10, failsafe 9/9, identical. That run also shows 5 pre-existing failures in the src/it invoker projects (a Groovy verify-script resolution error) which are present on master too and are unrelated to this change.

Draft until CI confirms.

Generated-by: Claude Opus 5 (1M context)

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)
@slachiewicz
slachiewicz marked this pull request as ready for review August 9, 2026 21:11
@slachiewicz
slachiewicz merged commit 894aac4 into master Aug 9, 2026
22 checks passed
@slachiewicz
slachiewicz deleted the agent/junit5-remote-resources-plugin branch August 9, 2026 21:11
@github-actions github-actions Bot added this to the 3.3.0 milestone Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant