ReadLength extends UnsignedIntLEByteValue { public static ReadLength of(byte... values) { return new ReadLength(values); } private  ReadLength(byte... values); private  ReadLength(long value); private  ReadLength(String length); private  ReadLength(ByteBuf byteBuf); static ReadLength of(byte... values); static ReadLength of(long value); static ReadLength of(String length); static ReadLength of(ByteBuf byteBuf); static final int NUM_BYTES; }
@Test public void ofBytes() { assertEquals(0L, ReadLength.of(NULL_BYTE, NULL_BYTE, NULL_BYTE, NULL_BYTE).getAsLong()); assertThrows(IllegalArgumentException.class, () -> ReadLength.of(NULL_BYTE, NULL_BYTE, NULL_BYTE, NULL_BYTE, NULL_BYTE)); }
@Test public void ofLong() { assertByte(ReadLength.of(1), "0x01000000"); assertByte(ReadLength.of(65535), "0xffff0000"); assertThrows(IllegalArgumentException.class, () -> ReadLength.of(-1)); assertThrows(IllegalArgumentException.class, () -> ReadLength.of(4294967296L)); }
@Test public void ofString() { assertByte(ReadLength.of("1"), "0x01000000"); }
@Test public void testToString() { assertThat(ReadLength.of("1").toString(), containsString("longValue=1,")); }