1 package org.tigris.scarab.util; 2 3 48 49 import java.net.URLDecoder ; 50 import java.net.URLEncoder ; 51 52 import junit.framework.TestCase; 53 54 60 public class ScarabUtilTest extends TestCase 61 { 62 63 64 public void testUrlEncode() 65 { 66 assertEquals("urlEncode of null should be null", null, ScarabUtil.urlEncode(null)); 67 assertEquals("urlEncode of empty string should be empty string", "", ScarabUtil.urlEncode("").toString()); 68 assertEquals("urlEncode of 'test' should be 'test'", "test", ScarabUtil.urlEncode("test").toString()); 69 assertEquals("urlEncode of '-_.!~*\'()' should remain the same", "-_.!~*\'()", ScarabUtil.urlEncode("-_.!~*\'()").toString()); 70 assertEquals("urlEncode of '\u00e4\u00f6\u00fc \u00df\u00c4\u00d6\u00dc?' should be some nasty url-string", URLEncoder.encode("\u00e4\u00f6\u00fc \u00df\u00c4\u00d6\u00dc?"), ScarabUtil.urlEncode("\u00e4\u00f6\u00fc \u00df\u00c4\u00d6\u00dc?").toString()); 71 assertEquals("urlEncode of 'test \u00e4\u00f6\u00fc' should be some nasty url-string", URLEncoder.encode("test \u00e4\u00f6\u00fc"), ScarabUtil.urlEncode("test \u00e4\u00f6\u00fc").toString()); 72 } 73 } 74 | Popular Tags |