TlvUtil { private static ITag searchTagById(final int tagId) { return EmvTags.getNotNull(TLVUtil.getTagAsBytes(tagId)); } private  TlvUtil(); static String getFormattedTagAndLength(final byte[] data, final int indentLength); static TLV getNextTLV(final TLVInputStream stream); static List<TagAndLength> parseTagAndLength(final byte[] data); static String prettyPrintAPDUResponse(final byte[] data); static List<TLV> getlistTLV(final byte[] pData, final ITag pTag, final boolean pAdd); static List<TLV> getlistTLV(final byte[] pData, final ITag... pTag); static byte[] getValue(final byte[] pData, final ITag... pTag); static String prettyPrintAPDUResponse(final byte[] data, final int indentLength); static String getSpaces(final int length); static String prettyPrintHex(final String in, final int indent); static String prettyPrintHex(final byte[] data); static String prettyPrintHex(final String in, final int indent, final boolean wrapLines); static String getSafePrintChars(final byte[] byteArray); static String getSafePrintChars(final byte[] byteArray, final int startPos, final int length); static int getLength(final List<TagAndLength> pList);  }
@Test public void testSearchTagById() throws Exception { ITag tag = (ITag) ReflectionTestUtils.invokeMethod(TlvUtil.class, "searchTagById", 0x9F6B); Assertions.assertThat(tag).isEqualTo(EmvTags.TRACK2_DATA); tag = (ITag) ReflectionTestUtils.invokeMethod(TlvUtil.class, "searchTagById", 0xFFFF); Assertions.assertThat(tag.getName()).isEqualTo("[UNKNOWN TAG]"); Assertions.assertThat(tag.getDescription()).isEqualTo(""); Assertions.assertThat(tag.getTagBytes()).isEqualTo(BytesUtils.fromString("FFFF")); Assertions.assertThat(tag.getNumTagBytes()).isEqualTo(2); Assertions.assertThat(tag.isConstructed()).isEqualTo(true); Assertions.assertThat(tag.getTagValueType()).isEqualTo(TagValueTypeEnum.BINARY); Assertions.assertThat(tag.getType()).isEqualTo(TagTypeEnum.CONSTRUCTED); }