You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2015/03/26 01:15:48 UTC
[06/19] maven-surefire git commit: Add another integration test for
matching multiple class and method patterns
Add another integration test for matching multiple class and method patterns
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/1a0cb371
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/1a0cb371
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/1a0cb371
Branch: refs/heads/master
Commit: 1a0cb37172dcdcee236c0551122f597ae04caa8c
Parents: dbcb32e
Author: Jörn Horstmann <gi...@jhorstmann.net>
Authored: Sun Dec 21 17:15:06 2014 +0100
Committer: Jörn Horstmann <gi...@jhorstmann.net>
Committed: Sun Dec 21 17:15:06 2014 +0100
----------------------------------------------------------------------
.../its/TestMultipleMethodPatternsIT.java | 51 ++++++++++++
.../junit48-multiple-method-patterns/pom.xml | 73 +++++++++++++++++
.../src/test/java/junit4/BasicTest.java | 83 ++++++++++++++++++++
.../src/test/java/junit4/TestFive.java | 79 +++++++++++++++++++
.../src/test/java/junit4/TestFour.java | 79 +++++++++++++++++++
.../src/test/java/junit4/TestThree.java | 83 ++++++++++++++++++++
.../src/test/java/junit4/TestTwo.java | 76 ++++++++++++++++++
7 files changed, 524 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1a0cb371/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestMultipleMethodPatternsIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestMultipleMethodPatternsIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestMultipleMethodPatternsIT.java
new file mode 100644
index 0000000..655610f
--- /dev/null
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/TestMultipleMethodPatternsIT.java
@@ -0,0 +1,51 @@
+package org.apache.maven.surefire.its;
+
+import org.apache.maven.surefire.its.fixture.OutputValidator;
+import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
+import org.junit.Test;
+/*
+ * 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.
+ */
+
+
+/**
+ * Test project using -Dtest=mtClass#myMethod+myMethod2,secondClass#testMethod
+ *
+ * @author <a href="mailto:ytsolar@gmail.com">rainLee</a>
+ */
+public class TestMultipleMethodPatternsIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+
+ private static final String RUNNING_WITH_JUNIT48 = "parallel='none', perCoreThreadCount=true, threadCount=0";
+
+ public OutputValidator multipleMethod( String projectName )
+ throws Exception
+ {
+ return unpack( projectName ).executeTest().verifyErrorFreeLog().assertTestSuiteResults( 7, 0, 0, 0 );
+ }
+
+
+ @Test
+ public void testJunit48()
+ throws Exception
+ {
+ multipleMethod( "junit48-multiple-method-patterns" ).verifyTextInLog( RUNNING_WITH_JUNIT48 );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1a0cb371/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/pom.xml b/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/pom.xml
new file mode 100644
index 0000000..540de2a
--- /dev/null
+++ b/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/pom.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugins.surefire</groupId>
+ <artifactId>junit4</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>Test for JUnit 4.8.1</name>
+
+
+ <properties>
+ <junitVersion>4.8.1</junitVersion>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junitVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${surefire.version}</version>
+ <configuration>
+ <test>junit4.BasicTest#testSuccessOne+testFailOne,junit4.TestThree#testSuccess*,junit4.TestFour#testSuccess???,junit4.*Five#test*One</test>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>surefire-junit47</artifactId>
+ <version>${surefire.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1a0cb371/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/src/test/java/junit4/BasicTest.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/src/test/java/junit4/BasicTest.java b/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/src/test/java/junit4/BasicTest.java
new file mode 100644
index 0000000..de387d3
--- /dev/null
+++ b/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/src/test/java/junit4/BasicTest.java
@@ -0,0 +1,83 @@
+package junit4;
+
+
+/*
+ * 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.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class BasicTest
+{
+
+ private boolean setUpCalled = false;
+
+ private static boolean tearDownCalled = false;
+
+ @Before
+ public void setUp()
+ {
+ setUpCalled = true;
+ tearDownCalled = false;
+ System.out.println( "Called setUp" );
+ }
+
+ @After
+ public void tearDown()
+ {
+ setUpCalled = false;
+ tearDownCalled = true;
+ System.out.println( "Called tearDown" );
+ }
+
+ @Test
+ public void testSetUp()
+ {
+ Assert.assertTrue( "setUp was not called", setUpCalled );
+ }
+
+
+ @Test
+ public void testSuccessOne()
+ {
+ Assert.assertTrue( true );
+ }
+
+ @Test
+ public void testSuccessTwo()
+ {
+ Assert.assertTrue( true );
+ }
+
+ @Test
+ public void testFailOne()
+ {
+ Assert.assertFalse( false );
+ }
+
+ @AfterClass
+ public static void oneTimeTearDown()
+ {
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1a0cb371/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/src/test/java/junit4/TestFive.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/src/test/java/junit4/TestFive.java b/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/src/test/java/junit4/TestFive.java
new file mode 100644
index 0000000..0e69bd0
--- /dev/null
+++ b/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/src/test/java/junit4/TestFive.java
@@ -0,0 +1,79 @@
+package junit4;
+
+/*
+ * 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.junit.*;
+
+
+public class TestFive
+{
+
+ private boolean setUpCalled = false;
+
+ private static boolean tearDownCalled = false;
+
+ @Before
+ public void setUp()
+ {
+ setUpCalled = true;
+ tearDownCalled = false;
+ System.out.println( "Called setUp" );
+ }
+
+ @After
+ public void tearDown()
+ {
+ setUpCalled = false;
+ tearDownCalled = true;
+ System.out.println( "Called tearDown" );
+ }
+
+ @Test
+ public void testSetUp()
+ {
+ Assert.assertTrue( "setUp was not called", setUpCalled );
+ }
+
+
+ @Test
+ public void testSuccessOne()
+ {
+ Assert.assertTrue( true );
+ }
+
+ @Test
+ public void testSuccessTwo()
+ {
+ Assert.assertTrue( true );
+ }
+
+ @Test
+ public void testSuccessThree()
+ {
+ Assert.assertTrue( true );
+ }
+
+ @AfterClass
+ public static void oneTimeTearDown()
+ {
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1a0cb371/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/src/test/java/junit4/TestFour.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/src/test/java/junit4/TestFour.java b/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/src/test/java/junit4/TestFour.java
new file mode 100644
index 0000000..f9cc25a
--- /dev/null
+++ b/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/src/test/java/junit4/TestFour.java
@@ -0,0 +1,79 @@
+package junit4;
+
+/*
+ * 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.junit.*;
+
+
+public class TestFour
+{
+
+ private boolean setUpCalled = false;
+
+ private static boolean tearDownCalled = false;
+
+ @Before
+ public void setUp()
+ {
+ setUpCalled = true;
+ tearDownCalled = false;
+ System.out.println( "Called setUp" );
+ }
+
+ @After
+ public void tearDown()
+ {
+ setUpCalled = false;
+ tearDownCalled = true;
+ System.out.println( "Called tearDown" );
+ }
+
+ @Test
+ public void testSetUp()
+ {
+ Assert.assertTrue( "setUp was not called", setUpCalled );
+ }
+
+
+ @Test
+ public void testSuccessOne()
+ {
+ Assert.assertTrue( true );
+ }
+
+ @Test
+ public void testSuccessTwo()
+ {
+ Assert.assertTrue( true );
+ }
+
+ @Test
+ public void testSuccessThree()
+ {
+ Assert.assertTrue( true );
+ }
+
+ @AfterClass
+ public static void oneTimeTearDown()
+ {
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1a0cb371/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/src/test/java/junit4/TestThree.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/src/test/java/junit4/TestThree.java b/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/src/test/java/junit4/TestThree.java
new file mode 100644
index 0000000..ab728c3
--- /dev/null
+++ b/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/src/test/java/junit4/TestThree.java
@@ -0,0 +1,83 @@
+package junit4;
+
+/*
+ * 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.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class TestThree
+{
+
+ private boolean setUpCalled = false;
+
+ private static boolean tearDownCalled = false;
+
+ @Before
+ public void setUp()
+ {
+ setUpCalled = true;
+ tearDownCalled = false;
+ System.out.println( "Called setUp" );
+ }
+
+ @After
+ public void tearDown()
+ {
+ setUpCalled = false;
+ tearDownCalled = true;
+ System.out.println( "Called tearDown" );
+ }
+
+ @Test
+ public void testSetUp()
+ {
+ Assert.assertTrue( "setUp was not called", setUpCalled );
+ }
+
+
+ @Test
+ public void testSuccessOne()
+ {
+ Assert.assertTrue( true );
+ }
+
+ @Test
+ public void testSuccessTwo()
+ {
+ Assert.assertTrue( true );
+ }
+
+ @Test
+ public void testFailOne()
+ {
+ Assert.assertFalse( false );
+ }
+
+ @AfterClass
+ public static void oneTimeTearDown()
+ {
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/1a0cb371/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/src/test/java/junit4/TestTwo.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/src/test/java/junit4/TestTwo.java b/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/src/test/java/junit4/TestTwo.java
new file mode 100644
index 0000000..137bf8b
--- /dev/null
+++ b/surefire-integration-tests/src/test/resources/junit48-multiple-method-patterns/src/test/java/junit4/TestTwo.java
@@ -0,0 +1,76 @@
+package junit4;
+
+/*
+ * 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.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class TestTwo
+{
+
+ private boolean setUpCalled = false;
+
+ private static boolean tearDownCalled = false;
+
+ @Before
+ public void setUp()
+ {
+ setUpCalled = true;
+ tearDownCalled = false;
+ System.out.println( "Called setUp" );
+ }
+
+ @After
+ public void tearDown()
+ {
+ setUpCalled = false;
+ tearDownCalled = true;
+ System.out.println( "Called tearDown" );
+ }
+
+ @Test
+ public void testSetUp()
+ {
+ Assert.assertTrue( "setUp was not called", setUpCalled );
+ }
+
+
+ @Test
+ public void testSuccessOne()
+ {
+ Assert.assertTrue( true );
+ }
+
+ @Test
+ public void testSuccessTwo()
+ {
+ Assert.assertTrue( true );
+ }
+
+ @AfterClass
+ public static void oneTimeTearDown()
+ {
+
+ }
+
+}