### Question:
HexUniqueKeyFormatter extends BaseUniqueKeyFormatter implements UniqueKeyFormatter { @Override protected byte[] decodeFromString(String value) { try { return Hex.decodeHex(value.toCharArray()); } catch (DecoderException e) { throw new IllegalArgumentException("Value '" + value + "' can't be decoded as hex", e); } }    }### Answer:
@Test public void testDecodeFromString_SimpleCase() { HexUniqueKeyFormatter formatter = new HexUniqueKeyFormatter(); assertArrayEquals(new byte[] { 1, 2, 3, (byte)255 }, formatter.decodeFromString("010203ff")); }
@Test(expected = IllegalArgumentException.class) public void testDecodeFromString_NonHexString() { HexUniqueKeyFormatter formatter = new HexUniqueKeyFormatter(); formatter.decodeFromString("xyz"); }