Package org.sentinel.servers.http.protocol

Source Code of org.sentinel.servers.http.protocol.HTTPRequestHeadersTest

package org.sentinel.servers.http.protocol;

import org.sentinel.servers.http.protocol.HTTPRequestHeaders;
import static org.junit.Assert.*;
import org.junit.Test;

public class HTTPRequestHeadersTest
{
   
    public static final String validInitialHeader = "GET /some/path HTTP/1.1";

    @Test
    public void testValidInitialHeader()
    {
        HTTPRequestHeaders headers = new HTTPRequestHeaders(validInitialHeader);
        assertEquals("GET", headers.getMethod());
        assertEquals("/some/path", headers.getPath());
        assertEquals("HTTP/1.1", headers.getVersion());
    }
   
    @Test
    public void testMethod()
    {
        HTTPRequestHeaders headers = new HTTPRequestHeaders(validInitialHeader);
        headers.setMethod("POST");
        assertEquals("POST", headers.getMethod());
    }
   
    @Test
    public void testPath()
    {
        HTTPRequestHeaders headers = new HTTPRequestHeaders(validInitialHeader);
        headers.setPath("/some/other/path");
        assertEquals("/some/other/path", headers.getPath());
    }
   
    @Test
    public void testVersion()
    {
        HTTPRequestHeaders headers = new HTTPRequestHeaders(validInitialHeader);
        headers.setVersion("HTTP/1.0");
        assertEquals("HTTP/1.0", headers.getVersion());
    }
   
}
TOP

Related Classes of org.sentinel.servers.http.protocol.HTTPRequestHeadersTest

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.