### Question:
EnumeratedValueParser extends AbstractMultiTagParser<EnumeratedValue> { @Override protected EnumeratedValue parseElement(final String line) { final EtmPoint point = PointFactory.getPoint(getClass(), "parseElement(String)"); try { final int firstSpace = line.indexOf(' '); if (firstSpace < 0) { throw new InvalidDocumentationException("No space found in value definition: " + line); } final int secondSpace = line.indexOf(' ', firstSpace + 1); if (secondSpace < 0) { return new EnumeratedValue(decodeFieldValue(line.substring(firstSpace + 1))); } if (line.charAt(firstSpace + 1) == '"') { return getStringValue(firstSpace + 1, line); } final String fieldValue = decodeFieldValue(line.substring(firstSpace + 1, secondSpace)); final String description = line.substring(secondSpace + 1); return new EnumeratedValue(fieldValue, description); } finally { point.collect(); } }    }### Answer:
@Test public void testParse() { final int value = 1234; final String description = "i am the description"; final EnumeratedValue enumerated = parser.parseElement("@value " + Integer.toString(value) + " " + description); assertThat(enumerated.getValue()).isEqualTo(Integer.toString(value)); assertThat(enumerated.getDescription()).isEqualTo(description); }
@Test public void testParseEscapedQuotations() { final String value = "a value with \"\"escaped quotes\"\""; final String description = "a description of an escaped value"; final EnumeratedValue enumerated = parser.parseElement("@value \"" + value + "\" " + description); assertThat(enumerated.getValue()).isEqualTo(value.replaceAll("\"\"", "\"")); assertThat(enumerated.getDescription()).isEqualTo(description); }
@Test public void testParseEscapedQuotationsNoDocumentation() { final String value = "value with \"\"escaped quotes\"\" inside of it"; final EnumeratedValue enumerated = parser.parseElement("@value \"" + value + "\""); assertThat(enumerated.getValue()).isEqualTo(value.replaceAll("\"\"", "\"")); assertThat(enumerated.getDescription()).isEmpty(); }
@Test public void testParseNoDocumentation() { final int value = 4738; final EnumeratedValue enumerated = parser.parseElement("@value " + Integer.toString(value)); assertThat(enumerated.getValue()).isEqualTo(Integer.toString(value)); assertThat(enumerated.getDescription()).isEmpty(); }
@Test public void testParseQuotations() { final String value = "a value"; final String description = "a description of a string value"; final EnumeratedValue enumerated = parser.parseElement("@value \"" + value + "\" " + description); assertThat(enumerated.getValue()).isEqualTo(value); assertThat(enumerated.getDescription()).isEqualTo(description); }
@Test public void testParseQuotationsNoClosing() { final String line = "@value \"no closing quote\"\""; InvalidDocumentationException e = assertThrows(InvalidDocumentationException.class, () -> { parser.parseElement(line); }); assertThat(e.getMessage()).isEqualTo("Unable to find closing quotation of field value: " + line); }
@Test public void testParseQuotationsNoDocumentation() { final String value = "a value"; final EnumeratedValue enumerated = parser.parseElement("@value \"" + value + "\""); assertThat(enumerated.getValue()).isEqualTo(value); assertThat(enumerated.getDescription()).isEmpty(); }
@Test public void testParseQuotationsWithQuotedDocumentation() { final String value = "a value with quoted documentation"; final String description = "This is a \"description\". I hate it when people use \"air quotes\"."; final EnumeratedValue enumerated = parser.parseElement("@value \"" + value + "\" " + description); assertThat(enumerated.getValue()).isEqualTo(value); assertThat(enumerated.getDescription()).isEqualTo(description); }