### Question:
HexUtils { public static void nextBytes(String hexEncodedString, int offset, byte[] bytes) { final int charsToRead = bytes.length * 2; if (hexEncodedString.length() < offset + charsToRead) { throw new IllegalArgumentException(String.format("Can't read %d bytes from string %s with offset %d", bytes.length, hexEncodedString, offset)); } for (int i = 0; i < charsToRead; i += 2) { bytes[i / 2] = getNextByte(hexEncodedString, offset + i); } } 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 testStringTooSmall() { assertThatThrownBy(() -> HexUtils.nextBytes("00", 0, new byte[2])) .isInstanceOf(IllegalArgumentException.class) .hasMessage("Can't read 2 bytes from string 00 with offset 0"); }
@Test void testUnevenLength() { final byte[] bytes = new byte[1]; HexUtils.nextBytes("0a0", 0, bytes); assertThat(bytes).isEqualTo(new byte[]{10}); }