Make Junit4VersionsIT a parameterized test
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/41d1cfca Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/41d1cfca Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/41d1cfca Branch: refs/heads/junit5 Commit: 41d1cfca8519b1e0419609a9f5b15b84e89ac3d6 Parents: 86f89a8 Author: Benedikt Ritter <brit...@apache.org> Authored: Sun Oct 9 15:38:44 2016 +0200 Committer: Tibor17 <tibo...@lycos.com> Committed: Tue Oct 11 00:25:28 2016 +0200 ---------------------------------------------------------------------- .../maven/surefire/its/Junit4VersionsIT.java | 85 +++++++------------- 1 file changed, 28 insertions(+), 57 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/41d1cfca/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4VersionsIT.java ---------------------------------------------------------------------- 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 cf82e64..2296cf8 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 @@ package org.apache.maven.surefire.its; * 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 <a href="mailto:dfabul...@apache.org">Dan Fabulich</a> */ +@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<Object[]> 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 )