Home / Function/ shouldForwardReadCallsBlindly() — netty Function Reference

shouldForwardReadCallsBlindly() — netty Function Reference

Architecture documentation for the shouldForwardReadCallsBlindly() function in ReadOnlyByteBufTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  a523d5e1_de0b_ca8e_5ffc_3f6b1d842ff2["shouldForwardReadCallsBlindly()"]
  9d029ceb_0baf_f35e_1671_646a96ecf982["ReadOnlyByteBufTest"]
  a523d5e1_de0b_ca8e_5ffc_3f6b1d842ff2 -->|defined in| 9d029ceb_0baf_f35e_1671_646a96ecf982
  style a523d5e1_de0b_ca8e_5ffc_3f6b1d842ff2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/test/java/io/netty/buffer/ReadOnlyByteBufTest.java lines 98–140

    @Test
    public void shouldForwardReadCallsBlindly() throws Exception {
        ByteBuf buf = mock(ByteBuf.class);
        when(buf.order()).thenReturn(BIG_ENDIAN);
        when(buf.maxCapacity()).thenReturn(65536);
        when(buf.readerIndex()).thenReturn(0);
        when(buf.writerIndex()).thenReturn(0);
        when(buf.capacity()).thenReturn(0);

        when(buf.getBytes(1, (GatheringByteChannel) null, 2)).thenReturn(3);
        when(buf.getBytes(4, (OutputStream) null, 5)).thenReturn(buf);
        when(buf.getBytes(6, (byte[]) null, 7, 8)).thenReturn(buf);
        when(buf.getBytes(9, (ByteBuf) null, 10, 11)).thenReturn(buf);
        when(buf.getBytes(12, (ByteBuffer) null)).thenReturn(buf);
        when(buf.getByte(13)).thenReturn(Byte.valueOf((byte) 14));
        when(buf.getShort(15)).thenReturn(Short.valueOf((short) 16));
        when(buf.getUnsignedMedium(17)).thenReturn(18);
        when(buf.getInt(19)).thenReturn(20);
        when(buf.getLong(21)).thenReturn(22L);

        ByteBuffer bb = ByteBuffer.allocate(100);

        when(buf.nioBuffer(23, 24)).thenReturn(bb);
        when(buf.capacity()).thenReturn(27);

        ByteBuf roBuf = unmodifiableBuffer(buf);
        assertEquals(3, roBuf.getBytes(1, (GatheringByteChannel) null, 2));
        roBuf.getBytes(4, (OutputStream) null, 5);
        roBuf.getBytes(6, (byte[]) null, 7, 8);
        roBuf.getBytes(9, (ByteBuf) null, 10, 11);
        roBuf.getBytes(12, (ByteBuffer) null);
        assertEquals((byte) 14, roBuf.getByte(13));
        assertEquals((short) 16, roBuf.getShort(15));
        assertEquals(18, roBuf.getUnsignedMedium(17));
        assertEquals(20, roBuf.getInt(19));
        assertEquals(22L, roBuf.getLong(21));

        ByteBuffer roBB = roBuf.nioBuffer(23, 24);
        assertEquals(100, roBB.capacity());
        assertTrue(roBB.isReadOnly());

        assertEquals(27, roBuf.capacity());
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free