Home / File/ QpackEncoderDynamicTableTest.java — netty Source File

QpackEncoderDynamicTableTest.java — netty Source File

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

Entity Profile

Relationship Graph

Source Code

/*
 * Copyright 2021 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.http3;

import org.junit.jupiter.api.Test;

import static io.netty.handler.codec.http3.QpackUtil.MAX_HEADER_TABLE_SIZE;
import static java.lang.Math.toIntExact;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.lessThan;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

public class QpackEncoderDynamicTableTest {
    private static final QpackHeaderField emptyHeader = new QpackHeaderField("", "");
    private static final QpackHeaderField fooBarHeader = new QpackHeaderField("foo", "bar");
    private static final QpackHeaderField fooBar2Header = new QpackHeaderField("foo", "bar2");
    private static final QpackHeaderField fooBar3Header = new QpackHeaderField("foo", "bar3");

    private int insertCount;
    private long maxCapacity;

    @Test
    public void zeroCapacityIsAllowed() throws Exception {
        QpackEncoderDynamicTable table = newDynamicTable(0);

        assertThat("Header addition passed.", addHeader(table, emptyHeader),
                lessThan(0));
    }

    @Test
    public void maxCapacityIsAllowed() throws Exception {
        final QpackEncoderDynamicTable table = newDynamicTable(MAX_HEADER_TABLE_SIZE);
        addAndValidateHeader(table, emptyHeader);
    }

    @Test
    public void negativeCapacityIsDisallowed() {
        assertThrows(QpackException.class, () -> newDynamicTable(-1));
    }

    @Test
    public void capacityTooLarge() {
        assertThrows(QpackException.class, () -> newDynamicTable(Long.MAX_VALUE));
    }
// ... (202 more lines)

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free