@Test public void testCreateTLV() { CharTag tag = instance.createTLV("X7", "test"); assertAll( () -> assertEquals("X7", tag.getTagId()), () -> assertEquals("test", tag.getValue()), () -> assertNull(instance.getTagValue("X7")), () -> assertNull(instance.get("X7")) ); }
public CharTag createTLV(String tagId, String value) throws IllegalArgumentException { validateTag(tagId); int maxValueLength = (int) Math.pow(BigDecimal.TEN.doubleValue(), lenLen) - 1; if (value != null && value.length() > maxValueLength) throw new IllegalArgumentException( String.format("The value size %d of the tag '%s' has" + " exceeded the maximum allowable value %d" , value.length(), tagId, maxValueLength ) ); CharTag tag = new CharTag(tagId, value); tag.setLengthSize(lenLen); tag.withTagLengthSwap(swapTagWithLength); return tag; }
CharTagMap extends HashMap<String, CharTag> { public CharTag createTLV(String tagId, String value) throws IllegalArgumentException { validateTag(tagId); int maxValueLength = (int) Math.pow(BigDecimal.TEN.doubleValue(), lenLen) - 1; if (value != null && value.length() > maxValueLength) throw new IllegalArgumentException( String.format("The value size %d of the tag '%s' has" + " exceeded the maximum allowable value %d" , value.length(), tagId, maxValueLength ) ); CharTag tag = new CharTag(tagId, value); tag.setLengthSize(lenLen); tag.withTagLengthSwap(swapTagWithLength); return tag; } }
CharTagMap extends HashMap<String, CharTag> { public CharTag createTLV(String tagId, String value) throws IllegalArgumentException { validateTag(tagId); int maxValueLength = (int) Math.pow(BigDecimal.TEN.doubleValue(), lenLen) - 1; if (value != null && value.length() > maxValueLength) throw new IllegalArgumentException( String.format("The value size %d of the tag '%s' has" + " exceeded the maximum allowable value %d" , value.length(), tagId, maxValueLength ) ); CharTag tag = new CharTag(tagId, value); tag.setLengthSize(lenLen); tag.withTagLengthSwap(swapTagWithLength); return tag; }  }
CharTagMap extends HashMap<String, CharTag> { public CharTag createTLV(String tagId, String value) throws IllegalArgumentException { validateTag(tagId); int maxValueLength = (int) Math.pow(BigDecimal.TEN.doubleValue(), lenLen) - 1; if (value != null && value.length() > maxValueLength) throw new IllegalArgumentException( String.format("The value size %d of the tag '%s' has" + " exceeded the maximum allowable value %d" , value.length(), tagId, maxValueLength ) ); CharTag tag = new CharTag(tagId, value); tag.setLengthSize(lenLen); tag.withTagLengthSwap(swapTagWithLength); return tag; }  static CharTagMap getInstance(); void unpack(CharSequence data); String pack(); CharTagMap addTag(String tagId, String value); CharTag createTLV(String tagId, String value); String getTagValue(String tagId); boolean hasTag(String tagId); }
CharTagMap extends HashMap<String, CharTag> { public CharTag createTLV(String tagId, String value) throws IllegalArgumentException { validateTag(tagId); int maxValueLength = (int) Math.pow(BigDecimal.TEN.doubleValue(), lenLen) - 1; if (value != null && value.length() > maxValueLength) throw new IllegalArgumentException( String.format("The value size %d of the tag '%s' has" + " exceeded the maximum allowable value %d" , value.length(), tagId, maxValueLength ) ); CharTag tag = new CharTag(tagId, value); tag.setLengthSize(lenLen); tag.withTagLengthSwap(swapTagWithLength); return tag; }  static CharTagMap getInstance(); void unpack(CharSequence data); String pack(); CharTagMap addTag(String tagId, String value); CharTag createTLV(String tagId, String value); String getTagValue(String tagId); boolean hasTag(String tagId);  }