jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1468548 - /jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/TestHTTPUtils.java
Date Tue, 16 Apr 2013 18:33:19 GMT
Author: sebb
Date: Tue Apr 16 18:33:19 2013
New Revision: 1468548

URL: http://svn.apache.org/r1468548
Log:
Start unit test for sanitizeUrl

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/TestHTTPUtils.java

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/TestHTTPUtils.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/TestHTTPUtils.java?rev=1468548&r1=1468547&r2=1468548&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/TestHTTPUtils.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/util/TestHTTPUtils.java Tue Apr
16 18:33:19 2013
@@ -18,6 +18,7 @@
 
 package org.apache.jmeter.protocol.http.util;
 
+import java.net.URI;
 import java.net.URL;
 
 import junit.framework.TestCase;
@@ -80,4 +81,16 @@ public class TestHTTPUtils extends TestC
         assertEquals("http://host/..", ConversionUtils.removeSlashDotDot("http://host/.."));
         assertEquals("http://host/../abc", ConversionUtils.removeSlashDotDot("http://host/../abc"));
     }
+    
+    public void testsanitizeUrl() throws Exception {
+        testSanitizeUrl("http://localhost/", "http://localhost/");
+        testSanitizeUrl("http://localhost/a/b/c%7Cd", "http://localhost/a/b/c|d");
+        // TODO more tests needed
+    }
+    
+    private void testSanitizeUrl(String expected, String input) throws Exception {
+        final URL url = new URL(input);
+        final URI uri = new URI(expected);
+        assertEquals(uri, ConversionUtils.sanitizeUrl(url));
+    }
 }



Mime
View raw message