Fix UtilTest and replace ampersand in method encode too

This commit is contained in:
lvotypko committed 2012-06-13 13:17:19 +02:00
1 parent fed2d0ff47
commit c667523d44
2 files changed
+11 -2

No files matched your search

+10 -1
View File
@@ -121,6 +121,15 @@ public class UtilTest extends TestCase {
assertEquals(encoded, "http://hudson/job/Hudson%20Job");
}
/**
* Test that Strings that contain ampersand are correctly URL encoded.
*/
public void testEncodeAmpersand() {
final String urlWithAmpersand = "http://hudson/job/Hudson-job/label1&&label2";
String encoded = Util.encode(urlWithAmpersand);
assertEquals(encoded, "http://hudson/job/Hudson-job/label1%26%26label2");
}
/**
* Test the rawEncode() method.
*/
@@ -128,7 +137,7 @@ public class UtilTest extends TestCase {
String[] data = { // Alternating raw,encoded
"abcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ", "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"01234567890!@$&*()-_=+',.", "01234567890!@$&*()-_=+',.",
"01234567890!@$*()-_=+',.", "01234567890!@$*()-_=+',.",
" \"#%/:;<>?", "%20%22%23%25%2F%3A%3B%3C%3E%3F",
"[\\]^`{|}~", "%5B%5C%5D%5E%60%7B%7C%7D%7E",
"d\u00E9velopp\u00E9s", "d%C3%A9velopp%C3%A9s",