EmptyByteBufTest Class — netty Architecture
Architecture documentation for the EmptyByteBufTest class in EmptyByteBufTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 39b14dbe_5dfc_efb6_b919_0b1a849f7832["EmptyByteBufTest"] cb168a83_633a_b29c_730d_23579cf2d452["EmptyByteBufTest.java"] 39b14dbe_5dfc_efb6_b919_0b1a849f7832 -->|defined in| cb168a83_633a_b29c_730d_23579cf2d452 c525866b_3464_c918_4b19_352aab31e1ca["testIsContiguous()"] 39b14dbe_5dfc_efb6_b919_0b1a849f7832 -->|method| c525866b_3464_c918_4b19_352aab31e1ca ce380a6d_f5d7_7b83_f7b9_636d5b7af083["testIsWritable()"] 39b14dbe_5dfc_efb6_b919_0b1a849f7832 -->|method| ce380a6d_f5d7_7b83_f7b9_636d5b7af083 72ea1553_3317_011f_328d_dd8ae76b8d04["testWriteEmptyByteBuf()"] 39b14dbe_5dfc_efb6_b919_0b1a849f7832 -->|method| 72ea1553_3317_011f_328d_dd8ae76b8d04 b70f9ded_7757_e40e_772a_3468009ec8ea["testIsReadable()"] 39b14dbe_5dfc_efb6_b919_0b1a849f7832 -->|method| b70f9ded_7757_e40e_772a_3468009ec8ea 67475a12_2eb5_55c7_d76d_158e53134f16["testArray()"] 39b14dbe_5dfc_efb6_b919_0b1a849f7832 -->|method| 67475a12_2eb5_55c7_d76d_158e53134f16 63213a85_6393_3859_4384_04805daa66c6["testNioBuffer()"] 39b14dbe_5dfc_efb6_b919_0b1a849f7832 -->|method| 63213a85_6393_3859_4384_04805daa66c6 156c6f54_9c2a_e09a_62b7_fa0451ba0fb5["testMemoryAddress()"] 39b14dbe_5dfc_efb6_b919_0b1a849f7832 -->|method| 156c6f54_9c2a_e09a_62b7_fa0451ba0fb5 8f49832c_ec11_6e35_bd0a_9bf1b4550ddf["consistentEqualsAndHashCodeWithAbstractBytebuf()"] 39b14dbe_5dfc_efb6_b919_0b1a849f7832 -->|method| 8f49832c_ec11_6e35_bd0a_9bf1b4550ddf 2c3226ad_04a2_60fa_c35b_f5c185177933["testGetCharSequence()"] 39b14dbe_5dfc_efb6_b919_0b1a849f7832 -->|method| 2c3226ad_04a2_60fa_c35b_f5c185177933 1210e933_2580_bf81_4f65_2521a2b20e74["testReadString()"] 39b14dbe_5dfc_efb6_b919_0b1a849f7832 -->|method| 1210e933_2580_bf81_4f65_2521a2b20e74 fb19f1a5_3df0_034c_31bf_d9c12ddb87cf["testReadStringThrowsIndexOutOfBoundsException()"] 39b14dbe_5dfc_efb6_b919_0b1a849f7832 -->|method| fb19f1a5_3df0_034c_31bf_d9c12ddb87cf
Relationship Graph
Source Code
buffer/src/test/java/io/netty/buffer/EmptyByteBufTest.java lines 29–127
public class EmptyByteBufTest {
@Test
public void testIsContiguous() {
EmptyByteBuf empty = new EmptyByteBuf(UnpooledByteBufAllocator.DEFAULT);
assertTrue(empty.isContiguous());
}
@Test
public void testIsWritable() {
EmptyByteBuf empty = new EmptyByteBuf(UnpooledByteBufAllocator.DEFAULT);
assertFalse(empty.isWritable());
assertFalse(empty.isWritable(1));
}
@Test
public void testWriteEmptyByteBuf() {
EmptyByteBuf empty = new EmptyByteBuf(UnpooledByteBufAllocator.DEFAULT);
empty.writeBytes(Unpooled.EMPTY_BUFFER); // Ok
ByteBuf nonEmpty = UnpooledByteBufAllocator.DEFAULT.buffer().writeBoolean(false);
try {
empty.writeBytes(nonEmpty);
fail();
} catch (IndexOutOfBoundsException ignored) {
// Ignore.
} finally {
nonEmpty.release();
}
}
@Test
public void testIsReadable() {
EmptyByteBuf empty = new EmptyByteBuf(UnpooledByteBufAllocator.DEFAULT);
assertFalse(empty.isReadable());
assertFalse(empty.isReadable(1));
}
@Test
public void testArray() {
EmptyByteBuf empty = new EmptyByteBuf(UnpooledByteBufAllocator.DEFAULT);
assertTrue(empty.hasArray());
assertEquals(0, empty.array().length);
assertEquals(0, empty.arrayOffset());
}
@Test
public void testNioBuffer() {
EmptyByteBuf empty = new EmptyByteBuf(UnpooledByteBufAllocator.DEFAULT);
assertEquals(1, empty.nioBufferCount());
assertEquals(0, empty.nioBuffer().position());
assertEquals(0, empty.nioBuffer().limit());
assertSame(empty.nioBuffer(), empty.internalNioBuffer(empty.readerIndex(), 0));
}
@Test
public void testMemoryAddress() {
EmptyByteBuf empty = new EmptyByteBuf(UnpooledByteBufAllocator.DEFAULT);
if (empty.hasMemoryAddress()) {
assertNotEquals(0L, empty.memoryAddress());
} else {
try {
empty.memoryAddress();
fail();
} catch (UnsupportedOperationException ignored) {
// Ignore.
}
}
}
@Test
public void consistentEqualsAndHashCodeWithAbstractBytebuf() {
ByteBuf empty = new EmptyByteBuf(UnpooledByteBufAllocator.DEFAULT);
ByteBuf emptyAbstract = new UnpooledHeapByteBuf(UnpooledByteBufAllocator.DEFAULT, 0, 0);
assertEquals(emptyAbstract, empty);
assertEquals(emptyAbstract.hashCode(), empty.hashCode());
assertEquals(EmptyByteBuf.EMPTY_BYTE_BUF_HASH_CODE, empty.hashCode());
assertTrue(emptyAbstract.release());
assertFalse(empty.release());
}
@Test
Source
Frequently Asked Questions
What is the EmptyByteBufTest class?
EmptyByteBufTest is a class in the netty codebase, defined in buffer/src/test/java/io/netty/buffer/EmptyByteBufTest.java.
Where is EmptyByteBufTest defined?
EmptyByteBufTest is defined in buffer/src/test/java/io/netty/buffer/EmptyByteBufTest.java at line 29.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free