@Test
public void appendHexStringWithByteArray() throws Exception {

    StringBuilder s0 = new StringBuilder(100);
    s0.setLength(0);
    try {
        HexUtil.appendHexString(null, null);
        Assert.fail();
    } catch (NullPointerException e) {
        // correct behavior
    }
    Assert.assertEquals("", s0.toString());
    // a NULL byte array appends nothing (a noop)
    s0.setLength(0);
    HexUtil.appendHexString(s0, null);
    Assert.assertEquals("", s0.toString());
    s0.setLength(0);
    HexUtil.appendHexString(s0, new byte[0]);
    Assert.assertEquals("", s0.toString());
    s0.setLength(0);
    HexUtil.appendHexString(s0, new byte[] { 0x34 });
    Assert.assertEquals("34", s0.toString());
    s0.setLength(0);
    HexUtil.appendHexString(s0, new byte[] { 0x34, 0x35 });
    Assert.assertEquals("3435", s0.toString());
    s0.setLength(0);
    HexUtil.appendHexString(s0, new byte[] { (byte)0xFF, (byte)0xAB });
    Assert.assertEquals("FFAB", s0.toString());
}