You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by pg...@apache.org on 2012/07/28 22:26:04 UTC

svn commit: r1366767 - in /maven/surefire/trunk: maven-surefire-plugin/src/site/apt/examples/junit.apt.vm surefire-grouper/src/main/java/org/apache/maven/surefire/group/match/SingleGroupMatcher.java

Author: pgier
Date: Sat Jul 28 20:26:03 2012
New Revision: 1366767

URL: http://svn.apache.org/viewvc?rev=1366767&view=rev
Log:
[SUREFIRE-889] Support inheritance of JUnit test groups
Submitted by: Honza Brázdil

Modified:
    maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/junit.apt.vm
    maven/surefire/trunk/surefire-grouper/src/main/java/org/apache/maven/surefire/group/match/SingleGroupMatcher.java

Modified: maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/junit.apt.vm
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/junit.apt.vm?rev=1366767&r1=1366766&r2=1366767&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/junit.apt.vm (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/junit.apt.vm Sat Jul 28 20:26:03 2012
@@ -236,7 +236,13 @@ else
 </plugins>
 +---+
 
-  This will execute only those tests annotated with the <<<@Categories(com.mycompany.SlowTests.class)>>> annotation:
+  This will execute only those tests annotated with the <<<@Category(com.mycompany.SlowTests.class)>>> annotation and those tests
+  annotated with <<<@Category(com.mycompany.SlowerTests.class)>>> if class/interface <<<SlowerTests>>> is subclass of <<<SlowTests>>>:
+
++---+
+    public interface SlowTests{}
+    public interface SlowerTests extends SlowTests{}
++---+
 
 +---+
     public class AppTest {
@@ -247,6 +253,12 @@ else
       }
 
       @Test
+      @Category(com.mycompany.SlowerTests.class)
+      public void testSlower() {
+        System.out.println("slower");
+      }
+
+      @Test
       @Category(com.cmycompany.FastTests.class)
       public void testSlow() {
         System.out.println("fast");

Modified: maven/surefire/trunk/surefire-grouper/src/main/java/org/apache/maven/surefire/group/match/SingleGroupMatcher.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-grouper/src/main/java/org/apache/maven/surefire/group/match/SingleGroupMatcher.java?rev=1366767&r1=1366766&r2=1366767&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-grouper/src/main/java/org/apache/maven/surefire/group/match/SingleGroupMatcher.java (original)
+++ maven/surefire/trunk/surefire-grouper/src/main/java/org/apache/maven/surefire/group/match/SingleGroupMatcher.java Sat Jul 28 20:26:03 2012
@@ -65,12 +65,12 @@ public class SingleGroupMatcher
         {
             for ( Class<?> cls : cats )
             {
-                String name = cls.getName();
-                if ( enabledClass != null && enabledClass.getName().equals( name ) )
+                if ( enabledClass != null && enabledClass.isAssignableFrom(cls) )
                 {
                     return true;
                 }
 
+                String name = cls.getName();
                 if ( name.endsWith( enabled ) )
                 {
                     return true;