Repository: maven-surefire
Updated Branches:
  refs/heads/master 7cba980b8 -> 29f76bcb5


SUREFIRE-1028 Unable to run single test (junit)


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/29f76bcb
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/29f76bcb
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/29f76bcb

Branch: refs/heads/master
Commit: 29f76bcb516c05e0b3b3eb26cdff677907e238e0
Parents: 7cba980
Author: Tibor Digana <tibo...@lycos.com>
Authored: Sat Aug 30 12:09:37 2014 +0200
Committer: tibordigana <tibo...@lycos.com>
Committed: Sat Sep 13 12:40:20 2014 +0200

----------------------------------------------------------------------
 .../Surefire1028UnableToRunSingleTest.java      | 59 ++++++++++++++++++
 .../pom.xml                                     | 64 ++++++++++++++++++++
 .../test/java/jiras/surefire1028/SomeTest.java  | 36 +++++++++++
 .../surefire/common/junit48/FilterFactory.java  |  2 +-
 4 files changed, 160 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/29f76bcb/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1028UnableToRunSingleTest.java
----------------------------------------------------------------------
diff --git 
a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1028UnableToRunSingleTest.java
 
b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1028UnableToRunSingleTest.java
new file mode 100644
index 0000000..03492b3
--- /dev/null
+++ 
b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1028UnableToRunSingleTest.java
@@ -0,0 +1,59 @@
+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.SurefireJUnit4IntegrationTestCase;
+import org.apache.maven.surefire.its.fixture.SurefireLauncher;
+import org.junit.Test;
+
+/**
+ * Plugin Configuration: parallel=classes
+ * <p/>
+ * With Surefire 2.15
+ * {@code $ mvn test -Dtest=MyTest#testFoo}
+ * Results :
+ * Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+ * <p/>
+ * With Surefire 2.16
+ * {@code $ mvn test -Dtest=MyTest#testFoo}
+ * <p/>
+ * Results :
+ * Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
+ *
+ * @author <a href="mailto:tibor.dig...@gmail.com";>Tibor Digana (tibor17)</a>
+ * @see {@linkplain https://jira.codehaus.org/browse/SUREFIRE-1028}
+ * @since 2.18
+ */
+public class Surefire1028UnableToRunSingleTest
+    extends SurefireJUnit4IntegrationTestCase
+{
+
+    @Test
+    public void methodFilteringParallelExecution()
+    {
+        unpack().setTestToRun( "SomeTest#test" 
).parallelClasses().useUnlimitedThreads()
+                .executeTest().verifyErrorFree( 1 ).verifyTextInLog( "OK!" );
+    }
+
+    private SurefireLauncher unpack()
+    {
+        return unpack( "surefire-1028-unable-to-run-single-test" );
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/29f76bcb/surefire-integration-tests/src/test/resources/surefire-1028-unable-to-run-single-test/pom.xml
----------------------------------------------------------------------
diff --git 
a/surefire-integration-tests/src/test/resources/surefire-1028-unable-to-run-single-test/pom.xml
 
b/surefire-integration-tests/src/test/resources/surefire-1028-unable-to-run-single-test/pom.xml
new file mode 100644
index 0000000..e07ac6b
--- /dev/null
+++ 
b/surefire-integration-tests/src/test/resources/surefire-1028-unable-to-run-single-test/pom.xml
@@ -0,0 +1,64 @@
+<?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>
+  <parent>
+    <groupId>org.apache.maven.surefire</groupId>
+    <artifactId>it-parent</artifactId>
+    <version>1.0</version>
+    <relativePath>../pom.xml</relativePath>
+  </parent>
+  <groupId>org.apache.maven.plugins.surefire</groupId>
+  <artifactId>jiras-surefire-1028</artifactId>
+  <version>1.0</version>
+  <name>jiras-surefire-1028</name>
+  <url>http://maven.apache.org</url>
+  <contributors>
+    <contributor>
+      <name>Tibor Digana (tibor17)</name>
+      <email>tibor.dig...@gmail.com</email>
+      <timezone>+1</timezone>
+    </contributor>
+  </contributors>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.10</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.5.1</version>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/29f76bcb/surefire-integration-tests/src/test/resources/surefire-1028-unable-to-run-single-test/src/test/java/jiras/surefire1028/SomeTest.java
----------------------------------------------------------------------
diff --git 
a/surefire-integration-tests/src/test/resources/surefire-1028-unable-to-run-single-test/src/test/java/jiras/surefire1028/SomeTest.java
 
b/surefire-integration-tests/src/test/resources/surefire-1028-unable-to-run-single-test/src/test/java/jiras/surefire1028/SomeTest.java
new file mode 100644
index 0000000..71cc102
--- /dev/null
+++ 
b/surefire-integration-tests/src/test/resources/surefire-1028-unable-to-run-single-test/src/test/java/jiras/surefire1028/SomeTest.java
@@ -0,0 +1,36 @@
+package jiras.surefire1028;
+
+/*
+ * 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.Assert;
+import org.junit.Test;
+
+public class SomeTest {
+
+    @Test
+    public void test() {
+        System.out.println("OK!");
+    }
+
+    @Test
+    public void filteredOutTest() {
+        Assert.fail();
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/29f76bcb/surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/FilterFactory.java
----------------------------------------------------------------------
diff --git 
a/surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/FilterFactory.java
 
b/surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/FilterFactory.java
index 9171336..6492ac2 100644
--- 
a/surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/FilterFactory.java
+++ 
b/surefire-providers/common-junit48/src/main/java/org/apache/maven/surefire/common/junit48/FilterFactory.java
@@ -128,7 +128,7 @@ public class FilterFactory
         {
             for ( Description o : description.getChildren() )
             {
-                if ( isDescriptionMatch( o ) )
+                if ( isDescriptionMatch( o ) || shouldRun( o ) )
                 {
                     return true;
                 }

Reply via email to