You are viewing a plain text version of this content. The canonical link for it is here.
Posted to surefire-commits@maven.apache.org by be...@apache.org on 2010/01/06 22:02:07 UTC

svn commit: r896667 - in /maven/surefire/trunk: maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/ surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ surefire-integration-tests/src/test/resources/pojo-simple/ sur...

Author: bentmann
Date: Wed Jan  6 21:02:03 2010
New Revision: 896667

URL: http://svn.apache.org/viewvc?rev=896667&view=rev
Log:
o Fixed NPE in case neither JUnit nor TestNG are used

Added:
    maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/PojoSimpleTest.java   (with props)
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/pojo-simple/
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/pojo-simple/pom.xml   (with props)
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/pojo-simple/src/
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/pojo-simple/src/test/
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/pojo-simple/src/test/java/
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/pojo-simple/src/test/java/PojoTest.java   (with props)
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=896667&r1=896666&r2=896667&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 Wed Jan  6 21:02:03 2010
@@ -722,6 +722,10 @@
     }
 
     private boolean isWithinVersionSpec(Artifact artifact, String versionSpec) throws MojoExecutionException {
+        if ( artifact == null )
+        {
+            return false;
+        }
         try {
             VersionRange  range = VersionRange.createFromVersionSpec( versionSpec);
             return range.containsVersion( artifact.getSelectedVersion());

Added: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/PojoSimpleTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/PojoSimpleTest.java?rev=896667&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/PojoSimpleTest.java (added)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/PojoSimpleTest.java Wed Jan  6 21:02:03 2010
@@ -0,0 +1,30 @@
+package org.apache.maven.surefire.its;
+
+
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+
+/**
+ * Test support for POJO tests.
+ * 
+ * @author Benjamin Bentmann
+ */
+public class PojoSimpleTest
+    extends AbstractSurefireIT
+{
+
+    public void testit()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/pojo-simple" );
+
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        executeGoal( verifier, "test" );
+        verifier.resetStreams();
+        
+        HelperAssertions.assertTestSuiteResults( 2, 0, 1, 0, testDir );        
+    }
+
+}

Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/PojoSimpleTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/PojoSimpleTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/surefire/trunk/surefire-integration-tests/src/test/resources/pojo-simple/pom.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/pojo-simple/pom.xml?rev=896667&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/resources/pojo-simple/pom.xml (added)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/resources/pojo-simple/pom.xml Wed Jan  6 21:02:03 2010
@@ -0,0 +1,53 @@
+<?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>pojo-simple</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <name>Pojo simple test</name>
+
+  <!-- NOTE: This has no dependencies on JUnit or TestNG, just nothing -->
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.4</source>
+          <target>1.4</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>${surefire.version}</version>
+        <configuration>
+          <testFailureIgnore>true</testFailureIgnore>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/resources/pojo-simple/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/resources/pojo-simple/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/surefire/trunk/surefire-integration-tests/src/test/resources/pojo-simple/src/test/java/PojoTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/pojo-simple/src/test/java/PojoTest.java?rev=896667&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/resources/pojo-simple/src/test/java/PojoTest.java (added)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/resources/pojo-simple/src/test/java/PojoTest.java Wed Jan  6 21:02:03 2010
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+public class PojoTest
+{
+
+    public void testSuccess()
+    {
+        assert true;
+    }
+
+    public void testFailure()
+    {
+        assert false;
+    }
+
+}

Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/resources/pojo-simple/src/test/java/PojoTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/trunk/surefire-integration-tests/src/test/resources/pojo-simple/src/test/java/PojoTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision