Home / File/ HttpVersionParsingTest.java — netty Source File

HttpVersionParsingTest.java — netty Source File

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

Entity Profile

Relationship Graph

Source Code

/*
 * Copyright 2025 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;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class HttpVersionParsingTest {

    @Test
    void testStandardVersions() {
        HttpVersion v10 = HttpVersion.valueOf("HTTP/1.0");
        HttpVersion v11 = HttpVersion.valueOf("HTTP/1.1");

        assertSame(HttpVersion.HTTP_1_0, v10);
        assertSame(HttpVersion.HTTP_1_1, v11);

        assertEquals("HTTP", v10.protocolName());
        assertEquals(1, v10.majorVersion());
        assertEquals(0, v10.minorVersion());

        assertEquals("HTTP", v11.protocolName());
        assertEquals(1, v11.majorVersion());
        assertEquals(1, v11.minorVersion());
    }

    @Test
    void testLowerCaseProtocolNameNonStrict() {
        HttpVersion version = HttpVersion.valueOf("http/1.1");
        assertEquals("HTTP", version.protocolName());
        assertEquals(1, version.majorVersion());
        assertEquals(1, version.minorVersion());
        assertEquals("HTTP/1.1", version.text());
    }

    @Test
    void testMixedCaseProtocolNameNonStrict() {
        HttpVersion version = HttpVersion.valueOf("hTtP/1.0");
        assertEquals("HTTP", version.protocolName());
        assertEquals(1, version.majorVersion());
        assertEquals(0, version.minorVersion());
// ... (103 more lines)

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free