Author: dfabulich
Date: Sun Nov 25 13:29:25 2007
New Revision: 598060

URL: http://svn.apache.org/viewvc?rev=598060&view=rev
Log:
[SUREFIRE-167] Don't exclude test cases just because their name includes 
Abstract.  We can test for abstractness directly; use that instead.

Added:
    
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractTestCaseTest.java
    
maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration-abstract/
   (with props)
    
maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration-abstract/pom.xml
    
maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration-abstract/src/
    
maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration-abstract/src/test/
    
maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration-abstract/src/test/java/
    
maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration-abstract/src/test/java/abstractClasses/
    
maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration-abstract/src/test/java/abstractClasses/AbstractConcreteBasicTest.java
    
maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration-abstract/src/test/java/abstractClasses/NonInstantiableTest.java
Modified:
    
maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java

Modified: 
maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
URL: 
http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java?rev=598060&r1=598059&r2=598060&view=diff
==============================================================================
--- 
maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
 (original)
+++ 
maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
 Sun Nov 25 13:29:25 2007
@@ -183,7 +183,7 @@
     /**
      * List of patterns (separated by commas) used to specify the tests that 
should be excluded in testing. When not
      * specified and when the <code>test</code> parameter is not specified, 
the default excludes will be
-     * <code>**&#47;Abstract*Test.java  **&#47;Abstract*TestCase.java 
**&#47;*$*</code>.  This parameter is ignored if
+     * <code>**&#47;*$*</code> (which excludes all inner classes).  This 
parameter is ignored if
      * TestNG suiteXmlFiles are specified.
      * 
      * @parameter
@@ -696,8 +696,7 @@
                 if ( excludes == null || excludes.size() == 0 )
                 {
                     excludes =
-                        new ArrayList( Arrays.asList( new String[] { 
"**/Abstract*Test.java",
-                            "**/Abstract*TestCase.java", "**/*$*" } ) );
+                        new ArrayList( Arrays.asList( new String[] { "**/*$*" 
} ) );
                 }
             }
 

Added: 
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractTestCaseTest.java
URL: 
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractTestCaseTest.java?rev=598060&view=auto
==============================================================================
--- 
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractTestCaseTest.java
 (added)
+++ 
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractTestCaseTest.java
 Sun Nov 25 13:29:25 2007
@@ -0,0 +1,31 @@
+package org.apache.maven.surefire.its;
+
+import java.io.File;
+
+import org.apache.maven.integrationtests.AbstractMavenIntegrationTestCase;
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+/**
+ * Test files with "Abstract" in their name that aren't really abstract,
+ * and abstract classes that don't say "Abstract" in their name 
+ * 
+ * @author <a href="mailto:[EMAIL PROTECTED]">Dan Fabulich</a>
+ * 
+ */
+public class AbstractTestCaseTest
+    extends AbstractMavenIntegrationTestCase
+{
+    public void testAbstractTestCase ()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), 
"/default-configuration-abstract" );
+
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.executeGoal( "test" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+        
+        HelperAssertions.assertTestSuiteResults( 1, 0, 0, 0, testDir );        
+    }
+}

Propchange: 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration-abstract/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Nov 25 13:29:25 2007
@@ -0,0 +1,5 @@
+.classpath
+.project
+target
+.settings
+log.txt

Added: 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration-abstract/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration-abstract/pom.xml?rev=598060&view=auto
==============================================================================
--- 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration-abstract/pom.xml
 (added)
+++ 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration-abstract/pom.xml
 Sun Nov 25 13:29:25 2007
@@ -0,0 +1,40 @@
+<?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>default-configuration-abstract</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <name>Test for default configuration with abstract classes</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+</project>

Added: 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration-abstract/src/test/java/abstractClasses/AbstractConcreteBasicTest.java
URL: 
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration-abstract/src/test/java/abstractClasses/AbstractConcreteBasicTest.java?rev=598060&view=auto
==============================================================================
--- 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration-abstract/src/test/java/abstractClasses/AbstractConcreteBasicTest.java
 (added)
+++ 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration-abstract/src/test/java/abstractClasses/AbstractConcreteBasicTest.java
 Sun Nov 25 13:29:25 2007
@@ -0,0 +1,68 @@
+package abstractClasses;
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class AbstractConcreteBasicTest // not really abstract!
+    extends TestCase
+{
+
+    private boolean setUpCalled = false;
+
+    private static boolean tearDownCalled = false;
+
+    public AbstractConcreteBasicTest( String name, String extraName )
+    {
+        super( name );
+    }
+
+    public static Test suite()
+    {
+        System.out.println("suite");
+        TestSuite suite = new TestSuite();
+        Test test = new AbstractConcreteBasicTest( "testSetUp", "dummy" );
+        suite.addTest( test );
+        TestSetup setup = new TestSetup( suite )
+        {
+
+            protected void setUp()
+            {
+                //oneTimeSetUp();
+            }
+
+            protected void tearDown()
+            {
+                oneTimeTearDown();
+            }
+
+        };
+
+        return setup;
+    }
+
+    protected void setUp()
+    {
+        setUpCalled = true;
+        tearDownCalled = false;
+        System.out.println( "Called setUp" );
+    }
+
+    protected void tearDown()
+    {
+        setUpCalled = false;
+        tearDownCalled = true;
+        System.out.println( "Called tearDown" );
+    }
+
+    public void testSetUp()
+    {
+        assertTrue( "setUp was not called", setUpCalled );
+    }
+
+    public static void oneTimeTearDown()
+    {
+        assertTrue( "tearDown was not called", tearDownCalled );
+    }
+
+}

Added: 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration-abstract/src/test/java/abstractClasses/NonInstantiableTest.java
URL: 
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration-abstract/src/test/java/abstractClasses/NonInstantiableTest.java?rev=598060&view=auto
==============================================================================
--- 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration-abstract/src/test/java/abstractClasses/NonInstantiableTest.java
 (added)
+++ 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/default-configuration-abstract/src/test/java/abstractClasses/NonInstantiableTest.java
 Sun Nov 25 13:29:25 2007
@@ -0,0 +1,9 @@
+package abstractClasses;
+
+import junit.framework.TestCase;
+
+public abstract class NonInstantiableTest
+    extends TestCase
+{
+
+}


Reply via email to