### Question:
CryptographicServiceMessage implements Loggeable { public void addField(String tag, String content) { Objects.requireNonNull(tag, "The tag is required"); Objects.requireNonNull(content, "The content is required"); tag = tag.toUpperCase(); fields.put(tag, content); orderedTags.add(tag); } CryptographicServiceMessage();  CryptographicServiceMessage(String mcl); void setMCL(String mcl); String getMCL(); void addField(String tag, String content); String getFieldContent(String tag); @Override String toString(); @Override void dump(PrintStream p, String indent); static CryptographicServiceMessage parse(String csmString); static final String MCL_RSI; static final String MCL_KSM; static final String MCL_RSM; static final String MCL_ESM; static final String TAG_RCV; static final String TAG_ORG; static final String TAG_SVR; static final String TAG_KD; static final String TAG_CTP; static final String TAG_CTR; static final String TAG_ERF; }### Answer:
@Test void testAddField() { instance.addField("testTag", "testContent"); assertEquals(1, instance.fields.size()); assertEquals("testContent", instance.fields.get("TESTTAG")); assertEquals(1, instance.orderedTags.size()); assertEquals("TESTTAG", instance.orderedTags.get(0)); }
@Test void testAddFieldThrowsNullPointerException() { thrown = assertThrows(NullPointerException.class, () -> instance.addField("testTag", null) ); assertEquals("The content is required", thrown.getMessage()); assertEquals(0, instance.fields.size()); assertEquals(0, instance.orderedTags.size()); }
@Test void testAddFieldThrowsNullPointerException1() { thrown = assertThrows(NullPointerException.class, () -> instance.addField(null, "testContent") ); assertEquals("The tag is required", thrown.getMessage()); assertEquals(0, instance.fields.size()); assertEquals(0, instance.orderedTags.size()); }