| 1 package com.atlassian.seraph.util; 2 3 import junit.framework.TestCase; 4 5 7 public class TestCookieUtils extends TestCase 8 { 9 private String [] usernames = {"bob", "KaTe", "k8t3", "thisisaverylongusernamedude", "\043bob"}; 10 private String [] passwords = {"as93490874", "cmiller", "difure", "argonaut", "password", "KIEneuyfYEbr"}; 11 private String [] encodings = {"dIe", "cNf", "992", "eY8", "eee"}; 12 13 public void testEncodeDecode() 14 { 15 for (int i = 0; i < usernames.length; i++) 16 { 17 String username = usernames[i]; 18 for (int j = 0; j < passwords.length; j++) 19 { 20 String password = passwords[j]; 21 for (int k = 0; k < encodings.length; k++) 22 { 23 String encoding = encodings[k]; 24 25 String [] decoded = CookieUtils.decodePasswordCookie( 26 CookieUtils.encodePasswordCookie(username, password, encoding), 27 encoding); 28 29 assertEquals("username (encoding=" + encoding + ")", username, decoded[0]); 30 assertEquals("password (encoding=" + encoding + ")", password, decoded[1]); 31 } 32 } 33 } 34 } 35 36 } 37 38 | Popular Tags |