### Question:
TagValTextParser { public String getValue(String keyMsgType) throws IOException { if(keyToValue.containsKey(keyMsgType)) { return keyToValue.get(keyMsgType); } else { throw new IOException("Key " + keyMsgType + " doesn't exist in " + keyToValue); } } TagValTextParser(ByteBuffer buffer); String getValue(String keyMsgType); String getValueWithDefault(String keyMsgType, String defaultVal); int getValueAsInt(String keyIdField); int getValueAsIntWithDefault(String keyIdField, int defaultVal); @Override String toString();  }### Answer:
@Test public void testParseExampleJoin() throws IOException { TagValTextParser parser = toBuffer("MT=NJ|CV=ard8_1.0|NM=someone|~"); assertEquals("NJ", parser.getValue("MT")); assertEquals("ard8_1.0", parser.getValue("CV")); assertEquals("someone", parser.getValue("NM")); }
@Test public void testParseExampleWrongEnding() throws IOException { TagValTextParser parser = toBuffer("MT=NJ|CV=ard8_1.0|NM=~"); assertEquals("NJ", parser.getValue("MT")); assertEquals("ard8_1.0", parser.getValue("CV")); assertEquals("~", parser.getValue("NM")); }