### Question:
CharTagMap extends HashMap<String, CharTag> { public void unpack(CharSequence data) throws IllegalArgumentException { if (data == null) throw new IllegalArgumentException("TLV data are required to unpack"); CharBuffer buffer = CharBuffer.wrap(data); CharTag currentTag; while (buffer.hasRemaining()) { currentTag = getTLVMsg(buffer); put(currentTag.getTagId(), currentTag); } }  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);  }### Answer:
@Test public void testUnpackEmptyTag() { instance.unpack("02000"); assertAll( () -> assertEquals(1, instance.size()), () -> assertEquals("02", instance.get("02").getTagId()), () -> assertEquals("", instance.get("02").getValue()) ); }
@Test public void testUnpackOneTag() { instance.unpack("02008ValueXyZ"); assertAll( () -> assertEquals(1, instance.size()), () -> assertEquals("02", instance.get("02").getTagId()), () -> assertEquals("ValueXyZ", instance.get("02").getValue()) ); }
@Test public void testUnpackOneTagAndMissing() { instance.unpack("02008ValueXyZ"); assertAll( () -> assertEquals(1, instance.size()), () -> assertEquals("02", instance.get("02").getTagId()), () -> assertEquals("ValueXyZ", instance.get("02").getValue()), () -> assertNull(instance.get("03")) ); }
@Test public void testUnpackTwoTag() { instance.unpack("02008ValueXyZ03007ValueAb"); assertAll( () -> assertEquals(2, instance.size()), () -> assertEquals("02", instance.get("02").getTagId()), () -> assertEquals("ValueXyZ", instance.get("02").getValue()), () -> assertEquals("03", instance.get("03").getTagId()), () -> assertEquals("ValueAb", instance.get("03").getValue()) ); }
@Test public void testUnpackTwoTagReverted() { instance.unpack("03007ValueAb02008ValueXyZ"); assertAll( () -> assertEquals(2, instance.size()), () -> assertEquals("02", instance.get("02").getTagId()), () -> assertEquals("ValueXyZ", instance.get("02").getValue()), () -> assertEquals("03", instance.get("03").getTagId()), () -> assertEquals("ValueAb", instance.get("03").getValue()) ); }
@Test public void testUnpackTwoTagShortTag() { thrown = assertThrows(IllegalArgumentException.class, () -> instance.unpack("03008wartosc20") ); }
@Test public void testUnpackTwoTagShortLength() { thrown = assertThrows(IllegalArgumentException.class, () -> instance.unpack("0400") ); }
@Test public void testUnpackRevertedTwoTagShortValue() { thrown = assertThrows(IllegalArgumentException.class, () -> instance.unpack("04008wa") ); }
@Test public void testUnpackNull() { thrown = assertThrows(IllegalArgumentException.class, () -> instance.unpack(null) ); }