Home / Function/ testAll() — netty Function Reference

testAll() — netty Function Reference

Architecture documentation for the testAll() function in ByteBufStreamTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  167802d3_c55b_c2ed_846f_240a70d39e07["testAll()"]
  a5486ee2_8de3_00d9_5697_f3849d26246a["ByteBufStreamTest"]
  167802d3_c55b_c2ed_846f_240a70d39e07 -->|defined in| a5486ee2_8de3_00d9_5697_f3849d26246a
  style 167802d3_c55b_c2ed_846f_240a70d39e07 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/test/java/io/netty/buffer/ByteBufStreamTest.java lines 41–189

    @Test
    public void testAll() throws Exception {
        ByteBuf buf = Unpooled.buffer(0, 65536);

        try {
            new ByteBufOutputStream(null);
            fail();
        } catch (NullPointerException e) {
            // Expected
        }

        assertThrows(IndexOutOfBoundsException.class, () -> new ByteBufOutputStream(buf).write(EMPTY_BYTES, -1, 0));

        try (ByteBufOutputStream out = new ByteBufOutputStream(buf)) {
            assertSame(buf, out.buffer());
            out.writeBoolean(true);
            out.writeBoolean(false);
            out.writeByte(42);
            out.writeByte(224);
            out.writeBytes("Hello, World!");
            out.writeChars("Hello, World");
            out.writeChar('!');
            out.writeDouble(42.0);
            out.writeFloat(42.0f);
            out.writeInt(42);
            out.writeLong(42);
            out.writeShort(42);
            out.writeShort(49152);
            out.writeUTF("Hello, World!");
            out.writeBytes("The first line\r\r\n");
            out.write(EMPTY_BYTES);
            out.write(new byte[]{1, 2, 3, 4});
            out.write(new byte[]{1, 3, 3, 4}, 0, 0);
        }

        try {
            new ByteBufInputStream(null, true);
            fail();
        } catch (NullPointerException e) {
            // Expected
        }

        try {
            new ByteBufInputStream(null, 0, true);
            fail();
        } catch (NullPointerException e) {
            // Expected
        }

        try {
            new ByteBufInputStream(buf.retainedSlice(), -1, true);
        } catch (IllegalArgumentException e) {
            // Expected
        }

        try {
            new ByteBufInputStream(buf.retainedSlice(), buf.capacity() + 1, true);
        } catch (IndexOutOfBoundsException e) {
            // Expected
        }

        ByteBufInputStream in = new ByteBufInputStream(buf, true);
        try {
            assertTrue(in.markSupported());
            in.mark(Integer.MAX_VALUE);

            assertEquals(buf.writerIndex(), in.skip(Long.MAX_VALUE));
            assertFalse(buf.isReadable());

            in.reset();
            assertEquals(0, buf.readerIndex());

            assertEquals(4, in.skip(4));
            assertEquals(4, buf.readerIndex());
            in.reset();

            assertTrue(in.readBoolean());
            assertFalse(in.readBoolean());
            assertEquals(42, in.readByte());
            assertEquals(224, in.readUnsignedByte());

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free