Skip to content

Move the core IT suite off the JUnit 4 assertions (4.0.x) - #12719

Merged
slachiewicz merged 1 commit into
maven-4.0.xfrom
agent/junit5-core-it-straggler-4.0.x
Aug 10, 2026
Merged

Move the core IT suite off the JUnit 4 assertions (4.0.x)#12719
slachiewicz merged 1 commit into
maven-4.0.xfrom
agent/junit5-core-it-straggler-4.0.x

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

Five classes in its/core-it-suite were already annotated with the Jupiter @Test but still called org.junit.Assert, which is the only thing still pulling JUnit 4 onto the IT classpath. They now use org.junit.jupiter.api.Assertions.

Four needed nothing but the static import swapped. The fifth is the one worth a second look:

-        assertTrue("Jar output path was not built", Files.isRegularFile(jarPath));
+        assertTrue(Files.isRegularFile(jarPath), "Jar output path was not built");

The message is the first argument in JUnit 4 and the last in JUnit 5. Left as a plain import swap it would still compile — assertTrue(String, boolean) has no Jupiter overload, so that one actually fails to compile, but the equivalent assertEquals(message, expected, actual) form does not, and silently asserts the wrong thing. Worth watching for in similar cleanups.

Verification — please read before merging

I could not run this suite. The its reactor needs the 0.1-stub-SNAPSHOT plugin artifacts and 2.1-SNAPSHOT it-support artifacts built first, and that build does not complete in my environment. What I did instead:

  • a standalone javac compile check of the changed files against a classpath assembled from the cached maven-it-helper jar plus junit-jupiter-api/opentest4j/apiguardian, with no JUnit 4 jar present — clean
  • confirmed no org.junit.Assert reference remains anywhere in its/core-it-suite/src/test/java
  • confirmed no line exceeds 120 characters (the its reactor does not configure spotless, so there is no formatter to run)

So this is compile-checked, not test-run. Given the change is import-level plus one argument reorder, CI should settle it — but I would rather say that plainly than imply I ran the ITs.

The same change is on the 4.0.x line as a separate PR.

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

Five classes in the suite still reached for org.junit.Assert while already
being annotated with the Jupiter @test, so they were the last thing keeping
JUnit 4 on the its classpath. They now use org.junit.jupiter.api.Assertions.

Four of them only needed the static import swapped. The fifth,
MavenITmng7772CoreExtensionFoundTest, passed a message to assertTrue: the
message is the FIRST argument in JUnit 4 and the LAST in JUnit 5, so that
call is reordered rather than merely re-imported.

This is the 4.0.x counterpart of the same change on master.

Generated-by: Claude Opus 5 (1M context)
@slachiewicz
slachiewicz marked this pull request as ready for review August 9, 2026 22:03

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Clean and correct JUnit 4 to JUnit 5 assertion migration across 5 integration test files (4.0.x backport). The assertTrue argument reorder in MavenITmng7772CoreExtensionFoundTest is properly handled (JUnit 4 assertTrue(String, boolean) → JUnit 5 assertTrue(boolean, String)). The remaining 4 files are straightforward import swaps with no semantic changes. CI is green across all completed checks.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of gnodet

@slachiewicz
slachiewicz merged commit 4b330f5 into maven-4.0.x Aug 10, 2026
24 checks passed
@slachiewicz
slachiewicz deleted the agent/junit5-core-it-straggler-4.0.x branch August 10, 2026 00:14
@github-actions github-actions Bot added this to the 4.0.0-rc-7 milestone Aug 10, 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.

2 participants