Home / Function/ testIsTextWithInvalidIndexAndLength() — netty Function Reference

testIsTextWithInvalidIndexAndLength() — netty Function Reference

Architecture documentation for the testIsTextWithInvalidIndexAndLength() function in ByteBufUtilTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  b51be3fc_b6ee_86fa_08c3_ce8cab377f42["testIsTextWithInvalidIndexAndLength()"]
  1b32157c_4c5c_4c3c_706b_1a74a9afdca7["ByteBufUtilTest"]
  b51be3fc_b6ee_86fa_08c3_ce8cab377f42 -->|defined in| 1b32157c_4c5c_4c3c_706b_1a74a9afdca7
  style b51be3fc_b6ee_86fa_08c3_ce8cab377f42 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/test/java/io/netty/buffer/ByteBufUtilTest.java lines 912–945

    @ParameterizedTest(name = PARAMETERIZED_NAME)
    @MethodSource("noUnsafe")
    public void testIsTextWithInvalidIndexAndLength(BufferType bufferType) {
        ByteBuf buffer = buffer(bufferType, 4);
        try {
            buffer.writeBytes(new byte[4]);
            int[][] validIndexLengthPairs = {
                    {4, 0},
                    {0, 4},
                    {1, 3},
            };
            for (int[] pair : validIndexLengthPairs) {
                assertTrue(ByteBufUtil.isText(buffer, pair[0], pair[1], CharsetUtil.US_ASCII));
            }
            int[][] invalidIndexLengthPairs = {
                    {4, 1},
                    {-1, 2},
                    {3, -1},
                    {3, -2},
                    {5, 0},
                    {1, 5},
            };
            for (int[] pair : invalidIndexLengthPairs) {
                try {
                    ByteBufUtil.isText(buffer, pair[0], pair[1], CharsetUtil.US_ASCII);
                    fail("Expected IndexOutOfBoundsException");
                } catch (IndexOutOfBoundsException e) {
                    // expected
                }
            }
        } finally {
            buffer.release();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testIsTextWithInvalidIndexAndLength() do?
testIsTextWithInvalidIndexAndLength() is a function in the netty codebase, defined in buffer/src/test/java/io/netty/buffer/ByteBufUtilTest.java.
Where is testIsTextWithInvalidIndexAndLength() defined?
testIsTextWithInvalidIndexAndLength() is defined in buffer/src/test/java/io/netty/buffer/ByteBufUtilTest.java at line 912.

Analyze Your Own Codebase

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

Try Supermodel Free