RFC8294ByteBufUtils { public static void writeMandatoryUint24(final ByteBuf buf, final Uint24 value, final String name) { if (value == null) { throw new IllegalArgumentException(name + " is mandatory"); } writeUint24(buf, value); } private  RFC8294ByteBufUtils(); static @NonNull Uint24 readUint24(final ByteBuf buf); static void writeUint24(final ByteBuf buf, final Uint24 value); static void writeMandatoryUint24(final ByteBuf buf, final Uint24 value, final String name); static void writeOptionalUint24(final ByteBuf buf, final @Nullable Uint24 value); static void writeUint24OrZero(final ByteBuf buf, final @Nullable Uint24 value);  }
@Test public void testWriteMandatory() { final ByteBuf buf = Unpooled.buffer(); RFC8294ByteBufUtils.writeMandatoryUint24(buf, ONE_TWO_THREE, "foo"); assertMedium(buf); }
@Test(expected = IllegalArgumentException.class) public void testWriteMandatoryNull() { RFC8294ByteBufUtils.writeMandatoryUint24(Unpooled.buffer(), null, "foo"); }