diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire2010ParameterizedSelectionDoesNotWorkIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire2010ParameterizedSelectionDoesNotWorkIT.java new file mode 100644 index 0000000000..173b0d5cb5 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire2010ParameterizedSelectionDoesNotWorkIT.java @@ -0,0 +1,45 @@ +package org.apache.maven.surefire.its.jiras; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.surefire.its.fixture.OutputValidator; +import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; +import org.apache.maven.surefire.its.fixture.TestFile; +import org.junit.Test; + +/** + * @see SUREFIRE-2010 + */ +public class Surefire2010ParameterizedSelectionDoesNotWorkIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void testJUnit4() + { + OutputValidator validator = unpack( "surefire-2010-parameterized-selection-does-not-work" ).executeTest(); + TestFile surefireReportsFile = validator.getSurefireReportsFile( "de.dagere.peass.ExampleTestJUnit4.txt" ); + surefireReportsFile.assertContainsText( "Tests run: 2" ); + } + + public void testJUnit5() + { + + } +} diff --git a/surefire-its/src/test/resources/surefire-2010-parameterized-selection-does-not-work/pom.xml b/surefire-its/src/test/resources/surefire-2010-parameterized-selection-does-not-work/pom.xml new file mode 100644 index 0000000000..29745a98e3 --- /dev/null +++ b/surefire-its/src/test/resources/surefire-2010-parameterized-selection-does-not-work/pom.xml @@ -0,0 +1,68 @@ + + + + 4.0.0 + + org.apache.maven.surefire + it-parent + 1.0 + ../pom.xml + + org.apache.maven.plugins.surefire + jiras-surefire-2010 + 1.0 + http://maven.apache.org + + + DaGeRe + David Georg Reichelt (DaGeRe) + david_georg.reichelt@uni-leipzig.de + + Committer + + Europe/Berlin + + + + + junit + junit + 4.13.2 + test + + + org.junit.jupiter + junit-jupiter-params + 5.8.2 + test + + + + + + maven-surefire-plugin + + once + + + + + diff --git a/surefire-its/src/test/resources/surefire-2010-parameterized-selection-does-not-work/src/test/java/de/dagere/peass/ExampleTestJUnit4.java b/surefire-its/src/test/resources/surefire-2010-parameterized-selection-does-not-work/src/test/java/de/dagere/peass/ExampleTestJUnit4.java new file mode 100644 index 0000000000..b4baa8d6a6 --- /dev/null +++ b/surefire-its/src/test/resources/surefire-2010-parameterized-selection-does-not-work/src/test/java/de/dagere/peass/ExampleTestJUnit4.java @@ -0,0 +1,39 @@ +package de.dagere.peass; + +import java.util.Arrays; +import java.util.Collection; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +@RunWith( Parameterized.class ) +public class ExampleTestJUnit4 +{ + + @Parameters + public static Collection data() + { + return Arrays.asList( new Object[][] { { 0 }, { 1 } } ); + } + + int value; + + public ExampleTestJUnit4( int value ) + { + this.value = value; + } + + @Test + public void test() + { + System.out.println( value ); + } + + @Test + public void anotherTest() + { + System.out.println( "3 (and value ignored)" ); + } +} diff --git a/surefire-its/src/test/resources/surefire-2010-parameterized-selection-does-not-work/src/test/java/de/dagere/peass/ExampleTestJUnit5.java b/surefire-its/src/test/resources/surefire-2010-parameterized-selection-does-not-work/src/test/java/de/dagere/peass/ExampleTestJUnit5.java new file mode 100644 index 0000000000..e944c6e920 --- /dev/null +++ b/surefire-its/src/test/resources/surefire-2010-parameterized-selection-does-not-work/src/test/java/de/dagere/peass/ExampleTestJUnit5.java @@ -0,0 +1,23 @@ +package de.dagere.peass; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + +public class ExampleTestJUnit5 +{ + + @ParameterizedTest + @ValueSource( ints = { 0, 1 } ) + public void test( final int value ) + { + System.out.println( value ); + } + + @Test + public void anotherTest() + { + System.out.println( "3" ); + } + +} \ No newline at end of file