From c67f2399e72f01698340aaefaaae4c9117c4608b Mon Sep 17 00:00:00 2001 From: Sylwester Lachiewicz Date: Sun, 9 Aug 2026 23:28:34 +0200 Subject: [PATCH] Move the core IT suite off the JUnit 4 assertions 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) --- .../maven/it/MavenITgh10210SettingsXmlDecryptTest.java | 8 +++++--- .../maven/it/MavenITmng7772CoreExtensionFoundTest.java | 4 ++-- .../maven/it/MavenITmng8400CanonicalMavenHomeTest.java | 2 +- .../it/MavenITmng8414ConsumerPomWithNewFeaturesTest.java | 2 +- .../org/apache/maven/it/MavenITmng8594AtFileTest.java | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh10210SettingsXmlDecryptTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh10210SettingsXmlDecryptTest.java index 8742ff9388b6..dc01612f0d9c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh10210SettingsXmlDecryptTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITgh10210SettingsXmlDecryptTest.java @@ -22,9 +22,11 @@ import java.nio.file.Files; import java.util.Arrays; -import org.junit.Assert; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + /** * This is a test set for GH-10210. */ @@ -45,7 +47,7 @@ void testItPass() throws Exception { verifier.addCliArgument("process-resources"); verifier.execute(); - Assert.assertEquals( + assertEquals( Arrays.asList( "prop1=%{foo}.txt", "prop2=${foo}.txt", @@ -69,7 +71,7 @@ void testItFail() throws Exception { try { verifier.execute(); } catch (VerificationException e) { - Assert.assertTrue( + assertTrue( verifier.loadLogContent() .contains( "Could not decrypt password (fix the corrupted password or remove it, if unused) {L6L/HbmrY+cH+sNkphn-this password is corrupted intentionally-q3fguYepTpM04WlIXb8nB1pk=}")); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7772CoreExtensionFoundTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7772CoreExtensionFoundTest.java index 6b210695f1fd..cfcc4942d1b1 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7772CoreExtensionFoundTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7772CoreExtensionFoundTest.java @@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; public class MavenITmng7772CoreExtensionFoundTest extends AbstractMavenIntegrationTestCase { public MavenITmng7772CoreExtensionFoundTest() { @@ -66,7 +66,7 @@ public void testWithLibExtCoreExtensionsFound() throws Exception { Path jarPath = extensionBasedir.resolve("target").resolve("maven-it-core-extensions-0.1.jar"); - assertTrue("Jar output path was not built", Files.isRegularFile(jarPath)); + assertTrue(Files.isRegularFile(jarPath), "Jar output path was not built"); verifier = newVerifier(testDir.getAbsolutePath()); verifier.setUserHomeDirectory(Paths.get(testDir.toPath().toString(), "home-lib-ext")); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8400CanonicalMavenHomeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8400CanonicalMavenHomeTest.java index 5122d16567f8..e8e172f21e27 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8400CanonicalMavenHomeTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8400CanonicalMavenHomeTest.java @@ -27,7 +27,7 @@ import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * This is a test set for MNG-8400. diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8414ConsumerPomWithNewFeaturesTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8414ConsumerPomWithNewFeaturesTest.java index 37e5c9dca789..aefde2f1d8d2 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8414ConsumerPomWithNewFeaturesTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8414ConsumerPomWithNewFeaturesTest.java @@ -27,7 +27,7 @@ import org.apache.maven.model.v4.MavenStaxReader; import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; /** diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8594AtFileTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8594AtFileTest.java index a0ad34011e01..657b9660272c 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8594AtFileTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8594AtFileTest.java @@ -23,7 +23,7 @@ import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * This is a test set for MNG-8594.