Package org.webbitserver.helpers

Source Code of org.webbitserver.helpers.InboundCookieParserTest

package org.webbitserver.helpers;

import static org.junit.Assert.assertEquals;

import java.net.HttpCookie;
import java.util.ArrayList;
import java.util.List;

import org.junit.Test;
import org.webbitserver.helpers.InboundCookieParser;

public class InboundCookieParserTest {
    @Test
    public void testParseEmpty() throws Exception {
        List<String> values = new ArrayList<String>();
        assertEquals(new ArrayList<HttpCookie>(), InboundCookieParser.parse(values));
    }

    @Test
    public void testParse() throws Exception {
        List<String> values = new ArrayList<String>();
        values.add("test=me");
        values.add("testing=\"now\"");

        List<HttpCookie> expected = new ArrayList<HttpCookie>();
        expected.add(new HttpCookie("test", "me"));
        expected.add(new HttpCookie("testing", "now"));

        assertEquals(expected, InboundCookieParser.parse(values));
    }
}
TOP

Related Classes of org.webbitserver.helpers.InboundCookieParserTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.