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 hb...@apache.org on 2008/04/05 13:45:55 UTC

svn commit: r645082 - /maven/surefire/trunk/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportParserTest.java

Author: hboutemy
Date: Sat Apr  5 04:45:53 2008
New Revision: 645082

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

Modified:
    maven/surefire/trunk/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportParserTest.java

Modified: maven/surefire/trunk/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportParserTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportParserTest.java?rev=645082&r1=645081&r2=645082&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportParserTest.java (original)
+++ maven/surefire/trunk/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportParserTest.java Sat Apr  5 04:45:53 2008
@@ -23,7 +23,9 @@
 import org.apache.maven.reporting.MavenReportException;
 
 import java.io.File;
+import java.io.UnsupportedEncodingException;
 import java.net.URL;
+import java.net.URLDecoder;
 import java.text.NumberFormat;
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -47,7 +49,7 @@
     }
 
     public void testParseXMLReportFiles()
-        throws MavenReportException
+        throws MavenReportException, UnsupportedEncodingException
     {
         report.setReportsDirectory( getTestDir( "/test-reports" ) );
 
@@ -65,10 +67,11 @@
         }
     }
 
-    private File getTestDir( String path )
+    private File getTestDir( String path ) throws UnsupportedEncodingException
     {
         URL resource = getClass().getResource( path );
-        return new File( resource.getPath() );
+        // URLDecoder.decode necessary for JDK 1.5+, where spaces are escaped to %20
+        return new File( URLDecoder.decode( resource.getPath(), "UTF-8" ) ).getAbsoluteFile();
     }
 
     public void testParseTestSuiteName()