maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ken...@apache.org
Subject svn commit: r488511 - /maven/sandbox/surefire-plugin-merge/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
Date Tue, 19 Dec 2006 02:57:37 GMT
Author: kenney
Date: Mon Dec 18 18:57:36 2006
New Revision: 488511

URL: http://svn.apache.org/viewvc?view=rev&rev=488511
Log:
PR: MSUREFIRE-151

Fix 'No test frameworks available' when junit is not specified.

Fall back to the JUnit provider anyway, since it contains POJO support.

Btw, when first compiling a project with jUnit as a dep and JUnit testcode,
then removing src/test/java, followed by 'mvn test', the tests run normally.

Tested with a POJO test.

Modified:
    maven/sandbox/surefire-plugin-merge/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java

Modified: maven/sandbox/surefire-plugin-merge/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
URL: http://svn.apache.org/viewvc/maven/sandbox/surefire-plugin-merge/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java?view=diff&rev=488511&r1=488510&r2=488511
==============================================================================
--- maven/sandbox/surefire-plugin-merge/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
(original)
+++ maven/sandbox/surefire-plugin-merge/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
Mon Dec 18 18:57:36 2006
@@ -500,11 +500,9 @@
             }
             else
             {
-                // only need to discover JUnit if there is no TestNG, it runs the tests for
you.
-                if ( junitArtifact != null )
-                {
-                    addProvider( surefireBooter, "surefire-junit", surefireArtifact.getBaseVersion(),
null );
-                }
+                // add the JUnit provider as default - it doesn't require JUnit to be present,
+                // since it supports POJO tests.
+                addProvider( surefireBooter, "surefire-junit", surefireArtifact.getBaseVersion(),
null );
             }
         }
         catch ( ArtifactNotFoundException e )
@@ -586,14 +584,12 @@
                     testClassesDirectory, includes, excludes, groups, excludedGroups, Boolean.valueOf(
parallel ),
                     new Integer( threadCount ), testSourceDirectory.getAbsolutePath()} );
             }
-            else if ( junitArtifact != null )
+            else
             {
+                // fall back to JUnit, which also contains POJO support. Also it can run
+                // classes compiled against JUnit since it has a dependency on JUnit itself.
                 surefireBooter.addTestSuite( "org.apache.maven.surefire.junit.JUnitDirectoryTestSuite",
                                              new Object[]{testClassesDirectory, includes,
excludes} );
-            }
-            else
-            {
-                throw new MojoExecutionException( "No Java test frameworks found" );
             }
         }
 



Mime
View raw message