Home / Class/ ServerCookieDecoderTest Class — netty Architecture

ServerCookieDecoderTest Class — netty Architecture

Architecture documentation for the ServerCookieDecoderTest class in ServerCookieDecoderTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  d0a674bc_687d_fd48_2df1_78da505db812["ServerCookieDecoderTest"]
  8a2abfc6_c1bf_dbe2_068d_b7ce5d2504a2["ServerCookieDecoderTest.java"]
  d0a674bc_687d_fd48_2df1_78da505db812 -->|defined in| 8a2abfc6_c1bf_dbe2_068d_b7ce5d2504a2
  fe244e8c_1dd3_4113_8200_43a5db91e9a8["testDecodingSingleCookie()"]
  d0a674bc_687d_fd48_2df1_78da505db812 -->|method| fe244e8c_1dd3_4113_8200_43a5db91e9a8
  f1ec761d_e9cd_c959_bb00_4348f73e79e3["testDecodingMultipleCookies()"]
  d0a674bc_687d_fd48_2df1_78da505db812 -->|method| f1ec761d_e9cd_c959_bb00_4348f73e79e3
  1217c870_bcc1_3bf8_0a04_d4472b9d90ef["testDecodingAllMultipleCookies()"]
  d0a674bc_687d_fd48_2df1_78da505db812 -->|method| 1217c870_bcc1_3bf8_0a04_d4472b9d90ef
  cd78ad8b_0842_417f_1125_dd7ab845ec03["testDecodingGoogleAnalyticsCookie()"]
  d0a674bc_687d_fd48_2df1_78da505db812 -->|method| cd78ad8b_0842_417f_1125_dd7ab845ec03
  b04f665a_6299_c778_b9aa_0336de48424b["testDecodingLongValue()"]
  d0a674bc_687d_fd48_2df1_78da505db812 -->|method| b04f665a_6299_c778_b9aa_0336de48424b
  21f34f23_da46_c9f3_606c_e09b2c0d83a3["testDecodingOldRFC2965Cookies()"]
  d0a674bc_687d_fd48_2df1_78da505db812 -->|method| 21f34f23_da46_c9f3_606c_e09b2c0d83a3
  d2521fce_c9d2_a60b_249b_f87ce3f82c33["testRejectCookieValueWithSemicolon()"]
  d0a674bc_687d_fd48_2df1_78da505db812 -->|method| d2521fce_c9d2_a60b_249b_f87ce3f82c33
  9e0208c3_dcf5_0ed5_f0eb_ffd8237b7a68["testCaseSensitiveNames()"]
  d0a674bc_687d_fd48_2df1_78da505db812 -->|method| 9e0208c3_dcf5_0ed5_f0eb_ffd8237b7a68

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/cookie/ServerCookieDecoderTest.java lines 29–220

public class ServerCookieDecoderTest {
    @Test
    public void testDecodingSingleCookie() {
        String cookieString = "myCookie=myValue";
        Set<Cookie> cookies = ServerCookieDecoder.STRICT.decode(cookieString);
        assertEquals(1, cookies.size());
        Cookie cookie = cookies.iterator().next();
        assertNotNull(cookie);
        assertEquals("myValue", cookie.value());
    }

    @Test
    public void testDecodingMultipleCookies() {
        String c1 = "myCookie=myValue;";
        String c2 = "myCookie2=myValue2;";
        String c3 = "myCookie3=myValue3;";

        Set<Cookie> cookies = ServerCookieDecoder.STRICT.decode(c1 + c2 + c3);
        assertEquals(3, cookies.size());
        Iterator<Cookie> it = cookies.iterator();
        Cookie cookie = it.next();
        assertNotNull(cookie);
        assertEquals("myValue", cookie.value());
        cookie = it.next();
        assertNotNull(cookie);
        assertEquals("myValue2", cookie.value());
        cookie = it.next();
        assertNotNull(cookie);
        assertEquals("myValue3", cookie.value());
    }

    @Test
    public void testDecodingAllMultipleCookies() {
        String c1 = "myCookie=myValue;";
        String c2 = "myCookie=myValue2;";
        String c3 = "myCookie=myValue3;";

        List<Cookie> cookies = ServerCookieDecoder.STRICT.decodeAll(c1 + c2 + c3);
        assertEquals(3, cookies.size());
        Iterator<Cookie> it = cookies.iterator();
        Cookie cookie = it.next();
        assertNotNull(cookie);
        assertEquals("myValue", cookie.value());
        cookie = it.next();
        assertNotNull(cookie);
        assertEquals("myValue2", cookie.value());
        cookie = it.next();
        assertNotNull(cookie);
        assertEquals("myValue3", cookie.value());
    }

    @Test
    public void testDecodingGoogleAnalyticsCookie() {
        String source =
            "ARPT=LWUKQPSWRTUN04CKKJI; " +
            "kw-2E343B92-B097-442c-BFA5-BE371E0325A2=unfinished_furniture; " +
            "__utma=48461872.1094088325.1258140131.1258140131.1258140131.1; " +
            "__utmb=48461872.13.10.1258140131; __utmc=48461872; " +
            "__utmz=48461872.1258140131.1.1.utmcsr=overstock.com|utmccn=(referral)|" +
                    "utmcmd=referral|utmcct=/Home-Garden/Furniture/Clearance/clearance/32/dept.html";
        Set<Cookie> cookies = ServerCookieDecoder.STRICT.decode(source);
        Iterator<Cookie> it = cookies.iterator();
        Cookie c;

        c = it.next();
        assertEquals("ARPT", c.name());
        assertEquals("LWUKQPSWRTUN04CKKJI", c.value());

        c = it.next();
        assertEquals("__utma", c.name());
        assertEquals("48461872.1094088325.1258140131.1258140131.1258140131.1", c.value());

        c = it.next();
        assertEquals("__utmb", c.name());
        assertEquals("48461872.13.10.1258140131", c.value());

        c = it.next();
        assertEquals("__utmc", c.name());
        assertEquals("48461872", c.value());

        c = it.next();

Frequently Asked Questions

What is the ServerCookieDecoderTest class?
ServerCookieDecoderTest is a class in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/cookie/ServerCookieDecoderTest.java.
Where is ServerCookieDecoderTest defined?
ServerCookieDecoderTest is defined in codec-http/src/test/java/io/netty/handler/codec/http/cookie/ServerCookieDecoderTest.java at line 29.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free