From a1cb6727d1cd03619757d921538070108d51680f Mon Sep 17 00:00:00 2001 From: Sylwester Lachiewicz Date: Sat, 31 Oct 2026 11:36:22 +0000 Subject: [PATCH 1/2] Use JUnit 5 and current plugin versions in the ITs --- modello-maven-plugin/pom.xml | 2 +- .../src/it/clone-java5/pom.xml | 13 ++--- .../src/test/java/test/CloneTest.java | 10 ++-- modello-maven-plugin/src/it/clone/pom.xml | 13 ++--- .../clone/src/test/java/test/CloneTest.java | 10 ++-- .../src/it/dom4j-no-plexus-utils/pom.xml | 6 +-- modello-maven-plugin/src/it/features/pom.xml | 6 +-- modello-maven-plugin/src/it/javadoc/pom.xml | 13 ++--- .../src/it/jdom-no-plexus-utils/pom.xml | 6 +-- .../src/it/maven-model/pom.xml | 9 ++-- .../modello/xpp3/Xpp3ParsingTest.java | 52 ++++++++----------- modello-maven-plugin/src/it/snakeyaml/pom.xml | 2 +- .../src/it/stax-no-plexus-utils/pom.xml | 6 +-- 13 files changed, 73 insertions(+), 75 deletions(-) diff --git a/modello-maven-plugin/pom.xml b/modello-maven-plugin/pom.xml index 599b55f9e..c5aa22f59 100644 --- a/modello-maven-plugin/pom.xml +++ b/modello-maven-plugin/pom.xml @@ -194,7 +194,7 @@ true 3.6.1 - ${junit4Version} + ${version.junit5} ${java.version} ${jdom.version} diff --git a/modello-maven-plugin/src/it/clone-java5/pom.xml b/modello-maven-plugin/src/it/clone-java5/pom.xml index 3a01b52ac..4ccce5b57 100644 --- a/modello-maven-plugin/src/it/clone-java5/pom.xml +++ b/modello-maven-plugin/src/it/clone-java5/pom.xml @@ -19,9 +19,10 @@ @plexusUtilsVersion@ - junit - junit - @junit4Version@ + org.junit.jupiter + junit-jupiter-api + @junit5Version@ + test @@ -31,7 +32,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.0 + 3.14.1 @javaVersion@ @javaVersion@ @@ -40,12 +41,12 @@ org.apache.maven.plugins maven-resources-plugin - 3.1.0 + 3.5.0 org.apache.maven.plugins maven-surefire-plugin - 2.22.0 + 3.5.6 org.codehaus.modello diff --git a/modello-maven-plugin/src/it/clone-java5/src/test/java/test/CloneTest.java b/modello-maven-plugin/src/it/clone-java5/src/test/java/test/CloneTest.java index 412e877f7..5f48730b8 100644 --- a/modello-maven-plugin/src/it/clone-java5/src/test/java/test/CloneTest.java +++ b/modello-maven-plugin/src/it/clone-java5/src/test/java/test/CloneTest.java @@ -4,12 +4,12 @@ import org.codehaus.plexus.util.xml.Xpp3Dom; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertSame; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertSame; public class CloneTest { diff --git a/modello-maven-plugin/src/it/clone/pom.xml b/modello-maven-plugin/src/it/clone/pom.xml index 063ae02ca..a5df98ab5 100644 --- a/modello-maven-plugin/src/it/clone/pom.xml +++ b/modello-maven-plugin/src/it/clone/pom.xml @@ -19,9 +19,10 @@ @plexusUtilsVersion@ - junit - junit - @junit4Version@ + org.junit.jupiter + junit-jupiter-api + @junit5Version@ + test @@ -31,7 +32,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.0 + 3.14.1 @javaVersion@ @javaVersion@ @@ -40,12 +41,12 @@ org.apache.maven.plugins maven-resources-plugin - 3.1.0 + 3.5.0 org.apache.maven.plugins maven-surefire-plugin - 2.22.0 + 3.5.6 org.codehaus.modello diff --git a/modello-maven-plugin/src/it/clone/src/test/java/test/CloneTest.java b/modello-maven-plugin/src/it/clone/src/test/java/test/CloneTest.java index ea97bca38..9cbc92859 100644 --- a/modello-maven-plugin/src/it/clone/src/test/java/test/CloneTest.java +++ b/modello-maven-plugin/src/it/clone/src/test/java/test/CloneTest.java @@ -4,12 +4,12 @@ import org.codehaus.plexus.util.xml.Xpp3Dom; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertSame; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertSame; public class CloneTest { diff --git a/modello-maven-plugin/src/it/dom4j-no-plexus-utils/pom.xml b/modello-maven-plugin/src/it/dom4j-no-plexus-utils/pom.xml index dda607fbb..4a0b2f468 100644 --- a/modello-maven-plugin/src/it/dom4j-no-plexus-utils/pom.xml +++ b/modello-maven-plugin/src/it/dom4j-no-plexus-utils/pom.xml @@ -29,7 +29,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.0 + 3.14.1 @javaVersion@ @javaVersion@ @@ -38,12 +38,12 @@ org.apache.maven.plugins maven-resources-plugin - 3.1.0 + 3.5.0 org.apache.maven.plugins maven-surefire-plugin - 2.22.0 + 3.5.6 org.codehaus.modello diff --git a/modello-maven-plugin/src/it/features/pom.xml b/modello-maven-plugin/src/it/features/pom.xml index 201661055..a6218fd15 100644 --- a/modello-maven-plugin/src/it/features/pom.xml +++ b/modello-maven-plugin/src/it/features/pom.xml @@ -53,7 +53,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.0 + 3.14.1 @javaVersion@ @javaVersion@ @@ -62,12 +62,12 @@ org.apache.maven.plugins maven-resources-plugin - 3.1.0 + 3.5.0 org.apache.maven.plugins maven-surefire-plugin - 2.22.0 + 3.5.6 org.apache.maven.plugins diff --git a/modello-maven-plugin/src/it/javadoc/pom.xml b/modello-maven-plugin/src/it/javadoc/pom.xml index 42ea53284..7bb293cab 100644 --- a/modello-maven-plugin/src/it/javadoc/pom.xml +++ b/modello-maven-plugin/src/it/javadoc/pom.xml @@ -14,9 +14,10 @@ @plexusUtilsVersion@ - junit - junit - @junit4Version@ + org.junit.jupiter + junit-jupiter-api + @junit5Version@ + test @@ -50,7 +51,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.0 + 3.14.1 @javaVersion@ @javaVersion@ @@ -59,12 +60,12 @@ org.apache.maven.plugins maven-resources-plugin - 3.1.0 + 3.5.0 org.apache.maven.plugins maven-surefire-plugin - 2.22.0 + 3.5.6 org.codehaus.modello diff --git a/modello-maven-plugin/src/it/jdom-no-plexus-utils/pom.xml b/modello-maven-plugin/src/it/jdom-no-plexus-utils/pom.xml index 7f2f65d7d..be9238882 100644 --- a/modello-maven-plugin/src/it/jdom-no-plexus-utils/pom.xml +++ b/modello-maven-plugin/src/it/jdom-no-plexus-utils/pom.xml @@ -29,7 +29,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.0 + 3.14.1 @javaVersion@ @javaVersion@ @@ -38,12 +38,12 @@ org.apache.maven.plugins maven-resources-plugin - 3.1.0 + 3.5.0 org.apache.maven.plugins maven-surefire-plugin - 2.22.0 + 3.5.6 org.codehaus.modello diff --git a/modello-maven-plugin/src/it/maven-model/pom.xml b/modello-maven-plugin/src/it/maven-model/pom.xml index fa7b10b63..b0c3c6326 100644 --- a/modello-maven-plugin/src/it/maven-model/pom.xml +++ b/modello-maven-plugin/src/it/maven-model/pom.xml @@ -12,7 +12,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.0 + 3.14.1 @javaVersion@ @javaVersion@ @@ -49,9 +49,10 @@ @plexusUtilsVersion@ - junit - junit - @junit4Version@ + org.junit.jupiter + junit-jupiter-api + @junit5Version@ + test diff --git a/modello-maven-plugin/src/it/maven-model/src/test/java/org/codehaus/modello/xpp3/Xpp3ParsingTest.java b/modello-maven-plugin/src/it/maven-model/src/test/java/org/codehaus/modello/xpp3/Xpp3ParsingTest.java index 3d8c009ed..3c1c146d2 100644 --- a/modello-maven-plugin/src/it/maven-model/src/test/java/org/codehaus/modello/xpp3/Xpp3ParsingTest.java +++ b/modello-maven-plugin/src/it/maven-model/src/test/java/org/codehaus/modello/xpp3/Xpp3ParsingTest.java @@ -1,47 +1,46 @@ package org.codehaus.modello.xpp3; -import static org.hamcrest.CoreMatchers.startsWith; +import java.io.File; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.codehaus.plexus.util.xml.XmlStreamReader; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; -import org.hamcrest.core.StringStartsWith; +import org.junit.jupiter.api.Test; -import java.io.File; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; /** @author Jason van Zyl */ public class Xpp3ParsingTest { - @Rule - public ExpectedException thrown= ExpectedException.none(); - - @Test - public void testXpp3ParsingWithModelWithWrongRootTag() + private static String readFailure( String modelFile ) throws Exception { - thrown.expectMessage( startsWith( "Expected root element 'project' but found 'model' (position: START_TAG seen ... @1:8" ) ); - - File model = new File( System.getProperty( "basedir" ), "src/test/models/model-with-wrong-root-tag.xml" ); + File model = new File( System.getProperty( "basedir" ), "src/test/models/" + modelFile ); MavenXpp3Reader reader = new MavenXpp3Reader(); - reader.read( new XmlStreamReader( model ), true ); + XmlPullParserException e = + assertThrows( XmlPullParserException.class, () -> reader.read( new XmlStreamReader( model ), true ) ); + return e.getMessage(); } @Test - public void testXpp3ParsingWithModelWithMissingElements() + public void testXpp3ParsingWithModelWithWrongRootTag() throws Exception { - thrown.expectMessage( startsWith( "Unrecognised tag: 'groupId' (position: START_TAG seen ..." ) ); - - File model = new File( System.getProperty( "basedir" ), "src/test/models/model-with-missing-elements.xml" ); - - MavenXpp3Reader reader = new MavenXpp3Reader(); + String message = readFailure( "model-with-wrong-root-tag.xml" ); + assertTrue( message.startsWith( + "Expected root element 'project' but found 'model' (position: START_TAG seen ... @1:8" ), message ); + } - reader.read( new XmlStreamReader( model ), true ); + @Test + public void testXpp3ParsingWithModelWithMissingElements() + throws Exception + { + String message = readFailure( "model-with-missing-elements.xml" ); + assertTrue( message.startsWith( "Unrecognised tag: 'groupId' (position: START_TAG seen ..." ), + message ); } @Test @@ -49,13 +48,8 @@ public void testXpp3ParsingWithModelWithPostTags() throws Exception { // internal message from MXParser - thrown.expectMessage( startsWith( "start tag not allowed in epilog" ) ); - - File model = new File( System.getProperty( "basedir" ), "src/test/models/model-with-post-tags.xml" ); - - MavenXpp3Reader reader = new MavenXpp3Reader(); - - reader.read( new XmlStreamReader( model ), true ); + String message = readFailure( "model-with-post-tags.xml" ); + assertTrue( message.startsWith( "start tag not allowed in epilog" ), message ); } } diff --git a/modello-maven-plugin/src/it/snakeyaml/pom.xml b/modello-maven-plugin/src/it/snakeyaml/pom.xml index 9e5d6f062..e617b0048 100644 --- a/modello-maven-plugin/src/it/snakeyaml/pom.xml +++ b/modello-maven-plugin/src/it/snakeyaml/pom.xml @@ -21,7 +21,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.0 + 3.14.1 @javaVersion@ @javaVersion@ diff --git a/modello-maven-plugin/src/it/stax-no-plexus-utils/pom.xml b/modello-maven-plugin/src/it/stax-no-plexus-utils/pom.xml index 1fc8bcd11..914ebf0d7 100644 --- a/modello-maven-plugin/src/it/stax-no-plexus-utils/pom.xml +++ b/modello-maven-plugin/src/it/stax-no-plexus-utils/pom.xml @@ -35,7 +35,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.0 + 3.14.1 @javaVersion@ @javaVersion@ @@ -44,12 +44,12 @@ org.apache.maven.plugins maven-resources-plugin - 3.1.0 + 3.5.0 org.apache.maven.plugins maven-surefire-plugin - 2.22.0 + 3.5.6 org.codehaus.modello From 3c67f18e296eeca8f1db458018d9ea0ee6af6b82 Mon Sep 17 00:00:00 2001 From: Sylwester Lachiewicz Date: Sat, 31 Oct 2026 11:36:22 +0000 Subject: [PATCH 2/2] Remove the unused JUnit 4 version --- pom.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pom.xml b/pom.xml index 0a3ec45ef..c0796262d 100644 --- a/pom.xml +++ b/pom.xml @@ -186,7 +186,6 @@ 1.7.36 1.1.1 3.6.3 - 4.13.2 2026-08-30T21:30:18Z @@ -330,11 +329,6 @@ slf4j-simple ${slf4j.version} - - junit - junit - ${junit4Version} - org.codehaus.plexus plexus-testing