jdk/test/java/net/CookieHandler/TestHttpCookie.java
changeset 1932 d3506bce7d27
parent 1247 b4c26443dee5
child 4324 5fd48b8b450b
equal deleted inserted replaced
1826:39d505a353e8 1932:d3506bce7d27
    22  */
    22  */
    23 
    23 
    24 /**
    24 /**
    25  * @test
    25  * @test
    26  * @summary Unit test for java.net.HttpCookie
    26  * @summary Unit test for java.net.HttpCookie
    27  * @bug 6244040 6277796 6277801 6277808 6294071 6692802
    27  * @bug 6244040 6277796 6277801 6277808 6294071 6692802 6790677
    28  * @author Edward Wang
    28  * @author Edward Wang
    29  */
    29  */
    30 
    30 
    31 import java.net.HttpCookie;
    31 import java.net.HttpCookie;
    32 import java.util.List;
    32 import java.util.List;
   276                 ";Secure")
   276                 ";Secure")
   277         .n("Customer").v("WILE_E_COYOTE").ver(1).p("/acme")
   277         .n("Customer").v("WILE_E_COYOTE").ver(1).p("/acme")
   278         .c("this is a coyote").cu("http://www.coyote.org").dsc(true)
   278         .c("this is a coyote").cu("http://www.coyote.org").dsc(true)
   279         .d(".coyote.org").a(3600).port("80");
   279         .d(".coyote.org").a(3600).port("80");
   280 
   280 
   281         // illegal characters in set-cookie header
       
   282         test("Set-Cookie2:Customer=;Version#=\"1\";Path=&\"/acme\"")
       
   283         .nil();
       
   284 
       
   285         // empty set-cookie string
   281         // empty set-cookie string
   286         test("").nil();
   282         test("").nil();
   287 
   283 
   288         // NullPointerException expected
   284         // NullPointerException expected
   289         try {
   285         try {
   309 
   305 
   310         // a header string contains 2 cookies
   306         // a header string contains 2 cookies
   311         test("Set-Cookie2:C1=\"V1\";Domain=\".sun1.com\";path=\"/www1\";Max-Age=\"100\",C2=\"V2\";Domain=\".sun2.com\";path=\"/www2\";Max-Age=\"200\"")
   307         test("Set-Cookie2:C1=\"V1\";Domain=\".sun1.com\";path=\"/www1\";Max-Age=\"100\",C2=\"V2\";Domain=\".sun2.com\";path=\"/www2\";Max-Age=\"200\"")
   312         .n(0, "C1").v(0, "V1").p(0, "/www1").a(0, 100).d(0, ".sun1.com")
   308         .n(0, "C1").v(0, "V1").p(0, "/www1").a(0, 100).d(0, ".sun1.com")
   313         .n(1, "C2").v(1, "V2").p(1, "/www2").a(1, 200).d(1, ".sun2.com");
   309         .n(1, "C2").v(1, "V2").p(1, "/www2").a(1, 200).d(1, ".sun2.com");
       
   310 
       
   311         // Bug 6790677: Should ignore bogus attributes
       
   312         test("Set-Cookie2:C1=\"V1\";foobar").n(0, "C1").v(0, "V1");
   314     }
   313     }
   315 
   314 
   316     static void netscape() {
   315     static void netscape() {
   317         header("Test using netscape cookie syntax");
   316         header("Test using netscape cookie syntax");
   318 
   317