maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject svn commit: r645076 - in /maven/plugin-tools/trunk/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util: PluginUtilsTest.java TestUtils.java
Date Sat, 05 Apr 2008 11:09:57 GMT
Author: hboutemy
Date: Sat Apr  5 04:09:56 2008
New Revision: 645076

URL: http://svn.apache.org/viewvc?rev=645076&view=rev
Log:
fixed tests when there are spaces in directory name

Modified:
    maven/plugin-tools/trunk/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/PluginUtilsTest.java
    maven/plugin-tools/trunk/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/TestUtils.java

Modified: maven/plugin-tools/trunk/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/PluginUtilsTest.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/PluginUtilsTest.java?rev=645076&r1=645075&r2=645076&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/PluginUtilsTest.java
(original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/PluginUtilsTest.java
Sat Apr  5 04:09:56 2008
@@ -27,6 +27,7 @@
 import org.codehaus.plexus.util.xml.XMLWriter;
 
 import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
 import java.util.Collections;
 
 /**
@@ -71,7 +72,7 @@
         assertEquals( pattern, output );
     }
 
-    public void testShouldFindTwoScriptsWhenNoExcludesAreGiven()
+    public void testShouldFindTwoScriptsWhenNoExcludesAreGiven() throws UnsupportedEncodingException
     {
         String testScript = "test.txt";
 
@@ -83,7 +84,7 @@
         assertEquals( 2, files.length );
     }
 
-    public void testShouldFindOneScriptsWhenAnExcludeIsGiven()
+    public void testShouldFindOneScriptsWhenAnExcludeIsGiven() throws UnsupportedEncodingException
     {
         String testScript = "test.txt";
 

Modified: maven/plugin-tools/trunk/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/TestUtils.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/TestUtils.java?rev=645076&r1=645075&r2=645076&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/TestUtils.java
(original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/TestUtils.java
Sat Apr  5 04:09:56 2008
@@ -21,7 +21,9 @@
 
 import junit.framework.TestCase;
 
+import java.io.UnsupportedEncodingException;
 import java.net.URL;
+import java.net.URLDecoder;
 
 /**
  * @author jdcasey
@@ -30,7 +32,7 @@
     extends TestCase
 {
 
-    public void testDirnameFunction_METATEST()
+    public void testDirnameFunction_METATEST() throws UnsupportedEncodingException
     {
         String classname = getClass().getName().replace( '.', '/' ) + ".class";
         String basedir = TestUtils.dirname( classname );
@@ -41,14 +43,16 @@
         assertEquals( resource.getPath(), basedir + classname );
     }
 
-    public static String dirname( String file )
+    public static String dirname( String file ) throws UnsupportedEncodingException
     {
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         URL fileResource = cl.getResource( file );
 
         String fullPath = fileResource.getPath();
 
-        return fullPath.substring( 0, fullPath.length() - file.length() );
+        String path = fullPath.substring( 0, fullPath.length() - file.length() );
+
+        return URLDecoder.decode( path, "UTF-8" ); // necessary for JDK 1.5+, where spaces
are escaped to %20
     }
 
 }



Mime
View raw message