Fixed test failures

This commit is contained in:
Trustin Lee 2009-03-13 15:53:52 +00:00
parent bbf32cae51
commit dc61906620

View File

@ -37,11 +37,11 @@ import org.junit.Test;
public class CookieEncoderTest { public class CookieEncoderTest {
@Test @Test
public void testEncodingSingleCookieV0() { public void testEncodingSingleCookieV0() {
String result = "myCookie=myValue;expires=XXX;path=/apathsomewhere;domain=.adomainsomewhere;secure"; String result = "myCookie=myValue;Expires=XXX;Path=/apathsomewhere;Domain=.adomainsomewhere;Secure";
Cookie cookie = new DefaultCookie("myCookie", "myValue"); Cookie cookie = new DefaultCookie("myCookie", "myValue");
CookieEncoder encoder = new CookieEncoder(true); CookieEncoder encoder = new CookieEncoder(true);
encoder.addCookie(cookie); encoder.addCookie(cookie);
cookie.setComment("this is a comment"); cookie.setComment("this is a Comment");
cookie.setCommentUrl("http://aurl.com"); cookie.setCommentUrl("http://aurl.com");
cookie.setDomain(".adomainsomewhere"); cookie.setDomain(".adomainsomewhere");
cookie.setDiscard(true); cookie.setDiscard(true);
@ -55,12 +55,12 @@ public class CookieEncoderTest {
} }
@Test @Test
public void testEncodingSingleCookieV1() { public void testEncodingSingleCookieV1() {
String result = "myCookie=myValue;max-age=50;path=/apathsomewhere;domain=.adomainsomewhere;secure;comment=this is a comment;version=1"; String result = "myCookie=myValue;Max-Age=50;Path=/apathsomewhere;Domain=.adomainsomewhere;Secure;Comment=this is a Comment;Version=1";
Cookie cookie = new DefaultCookie("myCookie", "myValue"); Cookie cookie = new DefaultCookie("myCookie", "myValue");
CookieEncoder encoder = new CookieEncoder(true); CookieEncoder encoder = new CookieEncoder(true);
encoder.addCookie(cookie); encoder.addCookie(cookie);
cookie.setVersion(1); cookie.setVersion(1);
cookie.setComment("this is a comment"); cookie.setComment("this is a Comment");
cookie.setDomain(".adomainsomewhere"); cookie.setDomain(".adomainsomewhere");
cookie.setMaxAge(50); cookie.setMaxAge(50);
cookie.setPath("/apathsomewhere"); cookie.setPath("/apathsomewhere");
@ -70,12 +70,12 @@ public class CookieEncoderTest {
} }
@Test @Test
public void testEncodingSingleCookieV2() { public void testEncodingSingleCookieV2() {
String result = "myCookie=myValue;max-age=50;path=/apathsomewhere;domain=.adomainsomewhere;secure;comment=this is a comment;version=1;commentURL=\"http://aurl.com\";port=\"80,8080\";discard"; String result = "myCookie=myValue;Max-Age=50;Path=/apathsomewhere;Domain=.adomainsomewhere;Secure;Comment=this is a Comment;Version=1;CommentURL=\"http://aurl.com\";Port=\"80,8080\";Discard";
Cookie cookie = new DefaultCookie("myCookie", "myValue"); Cookie cookie = new DefaultCookie("myCookie", "myValue");
CookieEncoder encoder = new CookieEncoder(true); CookieEncoder encoder = new CookieEncoder(true);
encoder.addCookie(cookie); encoder.addCookie(cookie);
cookie.setVersion(1); cookie.setVersion(1);
cookie.setComment("this is a comment"); cookie.setComment("this is a Comment");
cookie.setCommentUrl("http://aurl.com"); cookie.setCommentUrl("http://aurl.com");
cookie.setDomain(".adomainsomewhere"); cookie.setDomain(".adomainsomewhere");
cookie.setDiscard(true); cookie.setDiscard(true);
@ -89,13 +89,13 @@ public class CookieEncoderTest {
@Test @Test
public void testEncodingMultipleCookies() { public void testEncodingMultipleCookies() {
String c1 = "myCookie=myValue;max-age=50;path=/apathsomewhere;domain=.adomainsomewhere;secure;comment=this is a comment;version=1;commentURL=\"http://aurl.com\";port=\"80,8080\";discard;"; String c1 = "myCookie=myValue;Max-Age=50;Path=/apathsomewhere;Domain=.adomainsomewhere;Secure;Comment=this is a Comment;Version=1;CommentURL=\"http://aurl.com\";Port=\"80,8080\";Discard;";
String c2 = "myCookie2=myValue2;path=/anotherpathsomewhere;domain=.anotherdomainsomewhere;comment=this is another comment;version=1;commentURL=\"http://anotherurl.com\";"; String c2 = "myCookie2=myValue2;Path=/anotherpathsomewhere;Domain=.anotherdomainsomewhere;Comment=this is another Comment;Version=1;CommentURL=\"http://anotherurl.com\";";
String c3 = "myCookie3=myValue3;version=1"; String c3 = "myCookie3=myValue3;Version=1";
CookieEncoder encoder = new CookieEncoder(true); CookieEncoder encoder = new CookieEncoder(true);
Cookie cookie = new DefaultCookie("myCookie", "myValue"); Cookie cookie = new DefaultCookie("myCookie", "myValue");
cookie.setVersion(1); cookie.setVersion(1);
cookie.setComment("this is a comment"); cookie.setComment("this is a Comment");
cookie.setCommentUrl("http://aurl.com"); cookie.setCommentUrl("http://aurl.com");
cookie.setDomain(".adomainsomewhere"); cookie.setDomain(".adomainsomewhere");
cookie.setDiscard(true); cookie.setDiscard(true);
@ -106,7 +106,7 @@ public class CookieEncoderTest {
encoder.addCookie(cookie); encoder.addCookie(cookie);
Cookie cookie2 = new DefaultCookie("myCookie2", "myValue2"); Cookie cookie2 = new DefaultCookie("myCookie2", "myValue2");
cookie2.setVersion(1); cookie2.setVersion(1);
cookie2.setComment("this is another comment"); cookie2.setComment("this is another Comment");
cookie2.setCommentUrl("http://anotherurl.com"); cookie2.setCommentUrl("http://anotherurl.com");
cookie2.setDomain(".anotherdomainsomewhere"); cookie2.setDomain(".anotherdomainsomewhere");
cookie2.setDiscard(false); cookie2.setDiscard(false);