[SUREFIRE] refactoring: adapt junit 3 tests to junit 4 testsuite
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/4d7be01f Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/4d7be01f Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/4d7be01f Branch: refs/heads/master Commit: 4d7be01f3030fed09922f2fb9b14602f8c80c278 Parents: 72c9c5f Author: Tibor17 <tibo...@lycos.com> Authored: Tue Jul 14 22:59:14 2015 +0200 Committer: Tibor17 <tibo...@lycos.com> Committed: Thu Jul 23 23:28:13 2015 +0200 ---------------------------------------------------------------------- surefire-booter/pom.xml | 5 +++ .../maven/surefire/booter/JUnit4SuiteTest.java | 45 ++++++++++++++++++++ surefire-providers/common-junit48/pom.xml | 6 +-- .../common/junit48/JUnit4SuiteTest.java | 45 ++++++++++++++++++++ surefire-providers/surefire-junit47/pom.xml | 3 ++ .../surefire/junitcore/JUnit4SuiteTest.java | 24 +++++++---- .../surefire/junitcore/Surefire746Test.java | 2 +- 7 files changed, 118 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d7be01f/surefire-booter/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-booter/pom.xml b/surefire-booter/pom.xml index c1287f1..50598bf 100644 --- a/surefire-booter/pom.xml +++ b/surefire-booter/pom.xml @@ -49,6 +49,11 @@ <version>2.12.4</version> <!-- ${shadedVersion}, but resolved due to http://jira.codehaus.org/browse/MRELEASE-799 --> </dependency> </dependencies> + <configuration> + <includes> + <include>**/JUnit4SuiteTest.java</include> + </includes> + </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d7be01f/surefire-booter/src/test/java/org/apache/maven/surefire/booter/JUnit4SuiteTest.java ---------------------------------------------------------------------- diff --git a/surefire-booter/src/test/java/org/apache/maven/surefire/booter/JUnit4SuiteTest.java b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/JUnit4SuiteTest.java new file mode 100644 index 0000000..d426d27 --- /dev/null +++ b/surefire-booter/src/test/java/org/apache/maven/surefire/booter/JUnit4SuiteTest.java @@ -0,0 +1,45 @@ +package org.apache.maven.surefire.booter; + +/* + * 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 junit.framework.JUnit4TestAdapter; +import junit.framework.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +/** + * Adapt the JUnit4 tests which use only annotations to the JUnit3 test suite. + * + * @author Tibor Digana (tibor17) + * @since 2.19 + */ +@Suite.SuiteClasses( { + ClasspathTest.class, + PropertiesWrapperTest.class, + SurefireReflectorTest.class +} ) +@RunWith( Suite.class ) +public class JUnit4SuiteTest +{ + public static Test suite() + { + return new JUnit4TestAdapter( JUnit4SuiteTest.class ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d7be01f/surefire-providers/common-junit48/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-providers/common-junit48/pom.xml b/surefire-providers/common-junit48/pom.xml index 8724ad3..f742c16 100644 --- a/surefire-providers/common-junit48/pom.xml +++ b/surefire-providers/common-junit48/pom.xml @@ -80,9 +80,9 @@ <plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> - <excludes> - <exclude>**/fixture/**</exclude> - </excludes> + <includes> + <include>**/JUnit4SuiteTest.java</include> + </includes> </configuration> </plugin> </plugins> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d7be01f/surefire-providers/common-junit48/src/test/java/org/apache/maven/surefire/common/junit48/JUnit4SuiteTest.java ---------------------------------------------------------------------- diff --git a/surefire-providers/common-junit48/src/test/java/org/apache/maven/surefire/common/junit48/JUnit4SuiteTest.java b/surefire-providers/common-junit48/src/test/java/org/apache/maven/surefire/common/junit48/JUnit4SuiteTest.java new file mode 100644 index 0000000..547c381 --- /dev/null +++ b/surefire-providers/common-junit48/src/test/java/org/apache/maven/surefire/common/junit48/JUnit4SuiteTest.java @@ -0,0 +1,45 @@ +package org.apache.maven.surefire.common.junit48; + +/* + * 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 junit.framework.JUnit4TestAdapter; +import junit.framework.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +/** + * Adapt the JUnit4 tests which use only annotations to the JUnit3 test suite. + * + * @author Tibor Digana (tibor17) + * @since 2.19 + */ +@Suite.SuiteClasses( { + FilterFactoryTest.class, + JUnit48ReflectorTest.class, + JUnit48TestCheckerTest.class +} ) +@RunWith( Suite.class ) +public class JUnit4SuiteTest +{ + public static Test suite() + { + return new JUnit4TestAdapter( JUnit4SuiteTest.class ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d7be01f/surefire-providers/surefire-junit47/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-providers/surefire-junit47/pom.xml b/surefire-providers/surefire-junit47/pom.xml index 087c01e..ca86f31 100644 --- a/surefire-providers/surefire-junit47/pom.xml +++ b/surefire-providers/surefire-junit47/pom.xml @@ -69,6 +69,9 @@ <artifactId>maven-surefire-plugin</artifactId> <configuration> <redirectTestOutputToFile>true</redirectTestOutputToFile> + <includes> + <include>**/JUnit4SuiteTest.java</include> + </includes> </configuration> </plugin> <plugin> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d7be01f/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnit4SuiteTest.java ---------------------------------------------------------------------- diff --git a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnit4SuiteTest.java b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnit4SuiteTest.java index 6bb58e1..c38ba0a 100644 --- a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnit4SuiteTest.java +++ b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnit4SuiteTest.java @@ -35,13 +35,21 @@ import org.junit.runners.Suite; * @since 2.16 */ @Suite.SuiteClasses( { - Surefire746Test.class, - Surefire813IncorrectResultTest.class, - ParallelComputerUtilTest.class, - ParallelComputerBuilderTest.class, - SchedulingStrategiesTest.class, - JUnitCoreParametersTest.class, - OptimizedParallelComputerTest.class + Surefire746Test.class, + Surefire813IncorrectResultTest.class, + ParallelComputerUtilTest.class, + ParallelComputerBuilderTest.class, + SchedulingStrategiesTest.class, + JUnitCoreParametersTest.class, + OptimizedParallelComputerTest.class, + ConcurrentRunListenerTest.class, + ConfigurableParallelComputerTest.class, + JUnit4Reflector481Test.class, + JUnitCoreParametersTest.class, + JUnitCoreRunListenerTest.class, + MavenSurefireJUnit47RunnerTest.class, + MavenSurefireJUnit48RunnerTest.class, + TestMethodTest.class } ) @RunWith( Suite.class ) public class JUnit4SuiteTest @@ -50,4 +58,4 @@ public class JUnit4SuiteTest { return new JUnit4TestAdapter( JUnit4SuiteTest.class ); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d7be01f/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java ---------------------------------------------------------------------- diff --git a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java index 4563e6d..93873bf 100644 --- a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java +++ b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java @@ -98,7 +98,7 @@ public class Surefire746Test RunListener listener = ConcurrentRunListener.createInstance( testSetMap, reporterFactory, false, false, consoleLogger ); - TestsToRun testsToRun = new TestsToRun(Collections.<Class>singletonList( TestClassTest.class ) ); + TestsToRun testsToRun = new TestsToRun( Collections.<Class<?>>singletonList( TestClassTest.class ) ); org.junit.runner.notification.RunListener jUnit4RunListener = new JUnitCoreRunListener( listener, testSetMap );