Home / Function/ testEnsureWritableDoesntGrowTooMuch() — netty Function Reference

testEnsureWritableDoesntGrowTooMuch() — netty Function Reference

Architecture documentation for the testEnsureWritableDoesntGrowTooMuch() function in AbstractPooledByteBufTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  c457dc32_25aa_6c96_57d7_f725ca1dc1c8["testEnsureWritableDoesntGrowTooMuch()"]
  0134bc31_3b19_a967_d2aa_113b2ccd098c["AbstractPooledByteBufTest"]
  c457dc32_25aa_6c96_57d7_f725ca1dc1c8 -->|defined in| 0134bc31_3b19_a967_d2aa_113b2ccd098c
  b8bc1e06_1910_c817_ce88_108d0c0e3922["pooledByteBuf()"]
  c457dc32_25aa_6c96_57d7_f725ca1dc1c8 -->|calls| b8bc1e06_1910_c817_ce88_108d0c0e3922
  style c457dc32_25aa_6c96_57d7_f725ca1dc1c8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/test/java/io/netty/buffer/AbstractPooledByteBufTest.java lines 106–123

    @Test
    public void testEnsureWritableDoesntGrowTooMuch() {
        ByteBuf buffer = newBuffer(150, 500).writerIndex(100);

        assertEquals(50, buffer.writableBytes());
        int fastWritable = buffer.maxFastWritableBytes();
        assertTrue(fastWritable > 50);

        long handleBefore = pooledByteBuf(buffer).handle;

        // capacity expansion should not cause reallocation
        // (should grow precisely the specified amount)
        buffer.ensureWritable(fastWritable);
        assertEquals(handleBefore, pooledByteBuf(buffer).handle);
        assertEquals(100 + fastWritable, buffer.capacity());
        assertEquals(buffer.writableBytes(), buffer.maxFastWritableBytes());
        buffer.release();
    }

Domain

Subdomains

Frequently Asked Questions

What does testEnsureWritableDoesntGrowTooMuch() do?
testEnsureWritableDoesntGrowTooMuch() is a function in the netty codebase, defined in buffer/src/test/java/io/netty/buffer/AbstractPooledByteBufTest.java.
Where is testEnsureWritableDoesntGrowTooMuch() defined?
testEnsureWritableDoesntGrowTooMuch() is defined in buffer/src/test/java/io/netty/buffer/AbstractPooledByteBufTest.java at line 106.
What does testEnsureWritableDoesntGrowTooMuch() call?
testEnsureWritableDoesntGrowTooMuch() calls 1 function(s): pooledByteBuf.

Analyze Your Own Codebase

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

Try Supermodel Free