ByteValue implements ByteReadable { protected void assertLength(int length) { if (value.length != length) { throw new IllegalArgumentException("Expected length " + length + " got " + value.length); } } protected  ByteValue(byte... value); protected  ByteValue(ByteBuf byteBuf); static void checkUnsignedBounds(long value, int numberOfBytes); static void checkUnsignedBounds(BigInteger value, int numberOfBytes); @Override byte[] getBytes(); @Override ByteBuf getByteBuf(); @Override long getCalculatedLength(); static ByteValue of(byte... values); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void assertCorrectLength() { byteValue.assertLength(4); }
@Test(expected = IllegalArgumentException.class) public void assertCorrectLengthException() { byteValue.assertLength(3); }