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