ByteArrayConverter implements IStringConverter<byte[]> { @Override public byte[] convert(String value) { try { return ArrayConverter.hexStringToByteArray(value); } catch (IllegalArgumentException ex) { throw new ParameterException("Could not parse " + value + ". Not a hex String"); } }  @Override byte[] convert(String value);  }
@Test public void testConvert() { String testString = "00"; assertArrayEquals(new byte[] { 0x00 }, converter.convert(testString)); testString = "FF"; assertArrayEquals(new byte[] { (byte) 0xff }, converter.convert(testString)); testString = "FFFF"; assertArrayEquals(new byte[] { (byte) 0xff, (byte) 0xff }, converter.convert(testString)); }
@Test(expected = ParameterException.class) public void testConvertError() { converter.convert("hello world"); }