Author: olamy
Date: Wed Nov 14 13:10:51 2007
New Revision: 595059

URL: http://svn.apache.org/viewvc?rev=595059&view=rev
Log:
fix NPE in tests

Modified:
    maven/plugins/trunk/maven-clean-plugin/pom.xml
    
maven/plugins/trunk/maven-clean-plugin/src/test/java/org/apache/maven/plugin/clean/CleanMojoTest.java

Modified: maven/plugins/trunk/maven-clean-plugin/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clean-plugin/pom.xml?rev=595059&r1=595058&r2=595059&view=diff
==============================================================================
--- maven/plugins/trunk/maven-clean-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-clean-plugin/pom.xml Wed Nov 14 13:10:51 2007
@@ -74,6 +74,12 @@
       <version>3.8.1</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-plugin-testing-harness</artifactId>
+      <version>1.1</version>
+      <scope>test</scope>
+    </dependency>        
   </dependencies>
 
   <contributors>

Modified: 
maven/plugins/trunk/maven-clean-plugin/src/test/java/org/apache/maven/plugin/clean/CleanMojoTest.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clean-plugin/src/test/java/org/apache/maven/plugin/clean/CleanMojoTest.java?rev=595059&r1=595058&r2=595059&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-clean-plugin/src/test/java/org/apache/maven/plugin/clean/CleanMojoTest.java
 (original)
+++ 
maven/plugins/trunk/maven-clean-plugin/src/test/java/org/apache/maven/plugin/clean/CleanMojoTest.java
 Wed Nov 14 13:10:51 2007
@@ -19,21 +19,20 @@
  * under the License.
  */
 
-import junit.framework.TestCase;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.IOUtil;
-
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.util.Arrays;
 
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.FileUtils;
+
 /**
  * Test the clean mojo.
  */
 public class CleanMojoTest
-    extends TestCase
+    extends AbstractMojoTestCase
 {
     private static final String TARGET_TEST_DIR = 
"target/testDirectoryStructure";
 
@@ -124,7 +123,9 @@
         String base = TARGET_TEST_DIR + "/target";
 
         CleanMojo mojo = new CleanMojo();
-
+        MavenProjectStub project = new MavenProjectStub();
+        project.setExecutionRoot( false );
+        setVariableValueToObject( mojo, "project", project );
         mojo.addFileset( createFileset( base, "**/file.txt", "**/subdir/**" ) 
);
 
         String outputDirectory = TARGET_TEST_DIR + "/buildOutputDirectory";


Reply via email to