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