@Test public void testCreateTLVWithTagIdNull() { thrown = assertThrows(IllegalArgumentException.class, () -> instance.createTLV(null, "test") ); assertEquals("Tag identifier have to be specified", thrown.getMessage()); }
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);  }