Home / File/ ClientCookieDecoderTest.java — netty Source File

ClientCookieDecoderTest.java — netty Source File

Architecture documentation for ClientCookieDecoderTest.java, a java file in the netty codebase.

Entity Profile

Relationship Graph

Source Code

/*
 * Copyright 2014 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package io.netty.handler.codec.http.cookie;

import io.netty.handler.codec.DateFormatter;
import io.netty.handler.codec.http.cookie.CookieHeaderNames.SameSite;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import java.util.TimeZone;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

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());
    }

// ... (233 more lines)

Domain

Subdomains

Frequently Asked Questions

What does ClientCookieDecoderTest.java do?
ClientCookieDecoderTest.java is a source file in the netty codebase, written in java. It belongs to the Buffer domain, Allocators subdomain.
Where is ClientCookieDecoderTest.java in the architecture?
ClientCookieDecoderTest.java is located at codec-http/src/test/java/io/netty/handler/codec/http/cookie/ClientCookieDecoderTest.java (domain: Buffer, subdomain: Allocators, directory: codec-http/src/test/java/io/netty/handler/codec/http/cookie).

Analyze Your Own Codebase

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

Try Supermodel Free