TLV { public int getPosition() { return position; } TLV(byte[] binary); boolean parse(Tag tag, int offset); byte[] getValue(); int getPosition(); @Override String toString();  }
@Test public void getPosition() { Tag tag1 = new Tag(0x04, Tag.CONTEXT, PRIMITIVE, 1); TLV tlv = new TLV(ByteArrayUtil.fromHex("8405001122334484055566778899")); Assert.assertTrue(tlv.parse(tag1, 0)); Assert.assertEquals(2, tlv.getPosition()); Assert.assertArrayEquals(ByteArrayUtil.fromHex("0011223344"), tlv.getValue()); Assert.assertEquals(7, tlv.getPosition()); Assert.assertTrue(tlv.parse(tag1, tlv.getPosition())); Assert.assertEquals(9, tlv.getPosition()); Assert.assertArrayEquals(ByteArrayUtil.fromHex("5566778899"), tlv.getValue()); Assert.assertEquals(14, tlv.getPosition()); }