Use new API

This commit is contained in:
Enrique Zamudio
2013-01-18 13:33:06 -06:00
parent 4022ab3ad8
commit 92af1156cc
5 changed files with 37 additions and 29 deletions
+7 -1
View File
@@ -12,7 +12,7 @@ public class TestHexCodec {
public void encodeDecode(String hex) {
byte[] buf = HexCodec.hexDecode(hex);
Assert.assertEquals((hex.length() / 2) + (hex.length() % 2), buf.length);
String reenc = HexCodec.hexEncode(buf);
String reenc = HexCodec.hexEncode(buf, 0, buf.length);
if (reenc.startsWith("0") && !hex.startsWith("0")) {
Assert.assertEquals(reenc.substring(1), hex);
} else {
@@ -41,4 +41,10 @@ public class TestHexCodec {
encodeDecode("ABC");
}
@Test
public void testPartial() {
Assert.assertEquals("FF01", HexCodec.hexEncode(new byte[]{0, (byte)0xff, 1, 2, 3, 4},
1, 2));
}
}