Home / Class/ ClientCookieDecoderTest Class — netty Architecture

ClientCookieDecoderTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  2635e872_d46e_792f_9aed_dd9f06eec252["ClientCookieDecoderTest"]
  fb30e1fa_6b2b_dcd2_fad5_d9b4eaa1e040["ClientCookieDecoderTest.java"]
  2635e872_d46e_792f_9aed_dd9f06eec252 -->|defined in| fb30e1fa_6b2b_dcd2_fad5_d9b4eaa1e040
  2f9182bf_0dfe_f571_46e9_dc5f8022131b["testDecodingSingleCookieV0()"]
  2635e872_d46e_792f_9aed_dd9f06eec252 -->|method| 2f9182bf_0dfe_f571_46e9_dc5f8022131b
  7c2b0819_04d1_2f57_b1d2_22c4932976b1["testDecodingSingleCookieV0ExtraParamsIgnored()"]
  2635e872_d46e_792f_9aed_dd9f06eec252 -->|method| 7c2b0819_04d1_2f57_b1d2_22c4932976b1
  6c801617_5e3e_44ea_9674_42b94c74b94a["testDecodingSingleCookieV1()"]
  2635e872_d46e_792f_9aed_dd9f06eec252 -->|method| 6c801617_5e3e_44ea_9674_42b94c74b94a
  4dd1ccd4_4264_f18f_e97e_7bbfdade9129["testDecodingSingleCookieV1ExtraParamsIgnored()"]
  2635e872_d46e_792f_9aed_dd9f06eec252 -->|method| 4dd1ccd4_4264_f18f_e97e_7bbfdade9129
  caee3169_6027_9d32_5bb4_ca2f225130fa["testDecodingSingleCookieV2()"]
  2635e872_d46e_792f_9aed_dd9f06eec252 -->|method| caee3169_6027_9d32_5bb4_ca2f225130fa
  112f5e20_a5ae_2d39_b8ed_6ea704050542["testDecodingComplexCookie()"]
  2635e872_d46e_792f_9aed_dd9f06eec252 -->|method| 112f5e20_a5ae_2d39_b8ed_6ea704050542
  273f8351_e722_5c7f_30ec_e16debceaf64["testDecodingQuotedCookie()"]
  2635e872_d46e_792f_9aed_dd9f06eec252 -->|method| 273f8351_e722_5c7f_30ec_e16debceaf64
  070729b7_8785_cd76_c9d5_bbb6ed199f28["testDecodingGoogleAnalyticsCookie()"]
  2635e872_d46e_792f_9aed_dd9f06eec252 -->|method| 070729b7_8785_cd76_c9d5_bbb6ed199f28
  6d188370_bf4a_cfbb_4549_67fb3be5c94b["testDecodingLongDates()"]
  2635e872_d46e_792f_9aed_dd9f06eec252 -->|method| 6d188370_bf4a_cfbb_4549_67fb3be5c94b
  5745338a_a0ba_e03e_0ea8_a5110fe1c387["testDecodingValueWithCommaFails()"]
  2635e872_d46e_792f_9aed_dd9f06eec252 -->|method| 5745338a_a0ba_e03e_0ea8_a5110fe1c387
  6a653885_4a85_1361_2f55_73157bde543b["testDecodingWeirdNames1()"]
  2635e872_d46e_792f_9aed_dd9f06eec252 -->|method| 6a653885_4a85_1361_2f55_73157bde543b
  1a2b2950_fa3f_3a0b_a74c_432a38b17e76["testDecodingWeirdNames2()"]
  2635e872_d46e_792f_9aed_dd9f06eec252 -->|method| 1a2b2950_fa3f_3a0b_a74c_432a38b17e76
  3ad43c15_62b3_a341_8a54_54667790292d["testDecodingValuesWithCommasAndEqualsFails()"]
  2635e872_d46e_792f_9aed_dd9f06eec252 -->|method| 3ad43c15_62b3_a341_8a54_54667790292d

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/cookie/ClientCookieDecoderTest.java lines 37–292

public class ClientCookieDecoderTest {
    @Test
    public void testDecodingSingleCookieV0() {
        String cookieString = "myCookie=myValue;expires="
                + DateFormatter.format(new Date(System.currentTimeMillis() + 50000))
                + ";path=/apathsomewhere;domain=.adomainsomewhere;secure;SameSite=None;Partitioned";

        Cookie cookie = ClientCookieDecoder.STRICT.decode(cookieString);
        assertNotNull(cookie);
        assertEquals("myValue", cookie.value());
        assertEquals(".adomainsomewhere", cookie.domain());
        assertNotEquals(Long.MIN_VALUE, cookie.maxAge(),
                "maxAge should be defined when parsing cookie " + cookieString);
        assertTrue(cookie.maxAge() >= 40 && cookie.maxAge() <= 60,
                "maxAge should be about 50ms when parsing cookie " + cookieString);
        assertEquals("/apathsomewhere", cookie.path());
        assertTrue(cookie.isSecure());

        assertInstanceOf(DefaultCookie.class, cookie);
        DefaultCookie c = (DefaultCookie) cookie;
        assertEquals(SameSite.None, c.sameSite());
        assertTrue(c.isPartitioned());
    }

    @Test
    public void testDecodingSingleCookieV0ExtraParamsIgnored() {
        String cookieString = "myCookie=myValue;max-age=50;path=/apathsomewhere;" +
                "domain=.adomainsomewhere;secure;comment=this is a comment;version=0;" +
                "commentURL=http://aurl.com;port=\"80,8080\";discard;";
        Cookie cookie = ClientCookieDecoder.STRICT.decode(cookieString);
        assertNotNull(cookie);
        assertEquals("myValue", cookie.value());
        assertEquals(".adomainsomewhere", cookie.domain());
        assertEquals(50, cookie.maxAge());
        assertEquals("/apathsomewhere", cookie.path());
        assertTrue(cookie.isSecure());
    }

    @Test
    public void testDecodingSingleCookieV1() {
        String cookieString = "myCookie=myValue;max-age=50;path=/apathsomewhere;domain=.adomainsomewhere"
                + ";secure;comment=this is a comment;version=1;";
        Cookie cookie = ClientCookieDecoder.STRICT.decode(cookieString);
        assertEquals("myValue", cookie.value());
        assertNotNull(cookie);
        assertEquals(".adomainsomewhere", cookie.domain());
        assertEquals(50, cookie.maxAge());
        assertEquals("/apathsomewhere", cookie.path());
        assertTrue(cookie.isSecure());
    }

    @Test
    public void testDecodingSingleCookieV1ExtraParamsIgnored() {
        String cookieString = "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 = ClientCookieDecoder.STRICT.decode(cookieString);
        assertNotNull(cookie);
        assertEquals("myValue", cookie.value());
        assertEquals(".adomainsomewhere", cookie.domain());
        assertEquals(50, cookie.maxAge());
        assertEquals("/apathsomewhere", cookie.path());
        assertTrue(cookie.isSecure());
    }

    @Test
    public void testDecodingSingleCookieV2() {
        String cookieString = "myCookie=myValue;max-age=50;path=/apathsomewhere;"
                + "domain=.adomainsomewhere;secure;comment=this is a comment;version=2;"
                + "commentURL=http://aurl.com;port=\"80,8080\";discard;";
        Cookie cookie = ClientCookieDecoder.STRICT.decode(cookieString);
        assertNotNull(cookie);
        assertEquals("myValue", cookie.value());
        assertEquals(".adomainsomewhere", cookie.domain());
        assertEquals(50, cookie.maxAge());
        assertEquals("/apathsomewhere", cookie.path());
        assertTrue(cookie.isSecure());
    }

    @Test
    public void testDecodingComplexCookie() {

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free