### Question:
HexUtils { public static byte getNextByte(String hexEncodedString, int offset) { final int hi = hexCharToBinary(hexEncodedString.charAt(offset)); final int lo = hexCharToBinary(hexEncodedString.charAt(offset + 1)); if (hi == -1 || lo == -1) { throw new IllegalArgumentException("Not a hex encoded string: " + hexEncodedString + " at offset " + offset); } return (byte) ((hi << 4) + lo); } private  HexUtils(); static String bytesToHex(byte[] bytes); static void writeBytesAsHex(byte[] bytes, JsonWriter jw); static void writeBytesAsHex(byte[] bytes, StringBuilder sb); static void writeBytesAsHex(byte[] bytes, int offset, int length, StringBuilder sb); static void writeByteAsHex(byte b, StringBuilder sb); static byte getNextByte(String hexEncodedString, int offset); static void nextBytes(String hexEncodedString, int offset, byte[] bytes); static void decode(String hexEncodedString, int srcOffset, int srcLength, byte[] bytes, int destOffset); static void writeAsHex(long l, JsonWriter jw);  }### Answer:
@Test void testInvalidHex() { assertThatThrownBy(() -> HexUtils.getNextByte("0$", 0)) .isInstanceOf(IllegalArgumentException.class) .hasMessage("Not a hex encoded string: 0$ at offset 0"); }