Home / Function/ testUnmodifiableBuffer() — netty Function Reference

testUnmodifiableBuffer() — netty Function Reference

Architecture documentation for the testUnmodifiableBuffer() function in UnpooledTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  c63eea85_8236_1edb_a61c_932fb9bac174["testUnmodifiableBuffer()"]
  57588d83_f329_0d85_cfc5_eea9b8d43e8f["UnpooledTest"]
  c63eea85_8236_1edb_a61c_932fb9bac174 -->|defined in| 57588d83_f329_0d85_cfc5_eea9b8d43e8f
  style c63eea85_8236_1edb_a61c_932fb9bac174 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/test/java/io/netty/buffer/UnpooledTest.java lines 405–490

    @Test
    public void testUnmodifiableBuffer() throws Exception {
        ByteBuf buf = unmodifiableBuffer(buffer(16));

        try {
            buf.discardReadBytes();
            fail();
        } catch (UnsupportedOperationException e) {
            // Expected
        }

        try {
            buf.setByte(0, (byte) 0);
            fail();
        } catch (UnsupportedOperationException e) {
            // Expected
        }

        try {
            buf.setBytes(0, EMPTY_BUFFER, 0, 0);
            fail();
        } catch (UnsupportedOperationException e) {
            // Expected
        }

        try {
            buf.setBytes(0, EMPTY_BYTES, 0, 0);
            fail();
        } catch (UnsupportedOperationException e) {
            // Expected
        }

        try {
            buf.setBytes(0, ByteBuffer.allocate(0));
            fail();
        } catch (UnsupportedOperationException e) {
            // Expected
        }

        try {
            buf.setShort(0, (short) 0);
            fail();
        } catch (UnsupportedOperationException e) {
            // Expected
        }

        try {
            buf.setMedium(0, 0);
            fail();
        } catch (UnsupportedOperationException e) {
            // Expected
        }

        try {
            buf.setInt(0, 0);
            fail();
        } catch (UnsupportedOperationException e) {
            // Expected
        }

        try {
            buf.setLong(0, 0);
            fail();
        } catch (UnsupportedOperationException e) {
            // Expected
        }

        InputStream inputStream = Mockito.mock(InputStream.class);
        try {
            buf.setBytes(0, inputStream, 0);
            fail();
        } catch (UnsupportedOperationException e) {
            // Expected
        }
        Mockito.verifyNoInteractions(inputStream);

        ScatteringByteChannel scatteringByteChannel = Mockito.mock(ScatteringByteChannel.class);
        try {
            buf.setBytes(0, scatteringByteChannel, 0);
            fail();
        } catch (UnsupportedOperationException e) {

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free