Пример #1
0
 @Test
 public void shouldHaveSameByteOrder() {
   ByteBuf buf = Unpooled.buffer(1);
   assertSame(Unpooled.BIG_ENDIAN, Unpooled.unmodifiableBuffer(buf).order());
   buf = buf.order(LITTLE_ENDIAN);
   assertSame(Unpooled.LITTLE_ENDIAN, Unpooled.unmodifiableBuffer(buf).order());
 }
Пример #2
0
 @Test
 public void shouldReturnReadOnlyDerivedBuffer() {
   ByteBuf buf = Unpooled.unmodifiableBuffer(Unpooled.buffer(1));
   assertTrue(buf.duplicate() instanceof ReadOnlyByteBuf);
   assertTrue(buf.slice() instanceof ReadOnlyByteBuf);
   assertTrue(buf.slice(0, 1) instanceof ReadOnlyByteBuf);
   assertTrue(buf.duplicate() instanceof ReadOnlyByteBuf);
 }
Пример #3
0
 @Test
 public void shouldReturnWritableCopy() {
   ByteBuf buf = Unpooled.unmodifiableBuffer(Unpooled.buffer(1));
   assertFalse(buf.copy() instanceof ReadOnlyByteBuf);
 }
Пример #4
0
 @Test
 public void testUnwrap() {
   ByteBuf buf = Unpooled.buffer(1);
   assertSame(buf, ((WrappedByteBuf) Unpooled.unmodifiableBuffer(buf)).unwrap());
 }
Пример #5
0
 @Test
 public void testUnmodifiableBuffer() {
   assertTrue(Unpooled.unmodifiableBuffer(Unpooled.buffer(1)) instanceof ReadOnlyByteBuf);
 }