From e619e7ff44990142a6b61367cebc95908a1ddf91 Mon Sep 17 00:00:00 2001 From: Benedikt Ritter Date: Sun, 9 Oct 2016 15:38:44 +0200 Subject: [PATCH 1/2] Make Junit4VersionsIT a parameterized test --- .../maven/surefire/its/Junit4VersionsIT.java | 85 ++++++------------- 1 file changed, 28 insertions(+), 57 deletions(-) diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java index cf82e64335..2296cf879c 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java @@ -19,85 +19,56 @@ * under the License. */ +import java.util.Arrays; +import java.util.Collection; + import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; import org.apache.maven.surefire.its.fixture.SurefireLauncher; import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameter; + +import static org.junit.runners.Parameterized.*; /** * Basic suite test using all known versions of JUnit 4.x * * @author Dan Fabulich */ +@RunWith( Parameterized.class ) public class Junit4VersionsIT extends SurefireJUnit4IntegrationTestCase { - private SurefireLauncher unpack() - { - return unpack( "/junit4" ); - } - - @Test - public void test40() - throws Exception - { - runJUnitTest( "4.0" ); - } - - @Test - public void test41() - throws Exception - { - runJUnitTest( "4.1" ); + @Parameters( name = "{index}: JUnit {0}" ) + public static Collection junitVersions() { + return Arrays.asList( new Object[][]{ + { "4.0" }, + { "4.1" }, + { "4.2" }, + { "4.3" }, + { "4.3.1" }, + { "4.4" }, + { "4.5" }, + { "4.6" }, + { "4.7" } + } ); } - @Test - public void test42() - throws Exception - { - runJUnitTest( "4.2" ); - } + @Parameter + public String version; - @Test - public void test43() - throws Exception - { - runJUnitTest( "4.3" ); - } - - @Test - public void test431() - throws Exception - { - runJUnitTest( "4.3.1" ); - } - - @Test - public void test44() - throws Exception - { - runJUnitTest( "4.4" ); - } - - @Test - public void test45() - throws Exception - { - runJUnitTest( "4.5" ); - } - - @Test - public void test46() - throws Exception + private SurefireLauncher unpack() { - runJUnitTest( "4.6" ); + return unpack( "/junit4" ); } @Test - public void test47() + public void testJunit() throws Exception { - runJUnitTest( "4.7" ); + runJUnitTest( version ); } public void runJUnitTest( String version ) From fa086e0853b9729725690694875114440ad8890a Mon Sep 17 00:00:00 2001 From: Benedikt Ritter Date: Sun, 9 Oct 2016 15:40:55 +0200 Subject: [PATCH 2/2] Add missing JUnit 4 versions to Junit4VersionsIT --- .../maven/surefire/its/Junit4VersionsIT.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java index 2296cf879c..500591a41b 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java @@ -42,8 +42,9 @@ public class Junit4VersionsIT { @Parameters( name = "{index}: JUnit {0}" ) - public static Collection junitVersions() { - return Arrays.asList( new Object[][]{ + public static Collection junitVersions() + { + return Arrays.asList( new Object[][] { { "4.0" }, { "4.1" }, { "4.2" }, @@ -52,7 +53,14 @@ public static Collection junitVersions() { { "4.4" }, { "4.5" }, { "4.6" }, - { "4.7" } + { "4.7" }, + { "4.8" }, + { "4.8.1" }, + { "4.8.2" }, + { "4.9" }, + { "4.10" }, + { "4.11" }, + { "4.12" } } ); }