@Test public void testParseNoFirstSpace() { final String codeSet = "@codeSet237"; InvalidDocumentationException e = assertThrows(InvalidDocumentationException.class, () -> { parser.parseElement(codeSet); }); assertThat(e.getMessage()).isEqualTo("No space found in code set definition: " + codeSet); }
@Override protected CodeSet 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 code set definition: " + line); } final int secondSpace = line.indexOf(' ', firstSpace + 1); if (secondSpace < 0) { return new CodeSet(Integer.parseInt(line.substring(firstSpace + 1))); } final int codeSet = Integer.parseInt(line.substring(firstSpace + 1, secondSpace)); final String description = line.substring(secondSpace + 1); return new CodeSet(codeSet, description); } finally { point.collect(); } }
CodeSetParser extends AbstractMultiTagParser<CodeSet> { @Override protected CodeSet 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 code set definition: " + line); } final int secondSpace = line.indexOf(' ', firstSpace + 1); if (secondSpace < 0) { return new CodeSet(Integer.parseInt(line.substring(firstSpace + 1))); } final int codeSet = Integer.parseInt(line.substring(firstSpace + 1, secondSpace)); final String description = line.substring(secondSpace + 1); return new CodeSet(codeSet, description); } finally { point.collect(); } } }
CodeSetParser extends AbstractMultiTagParser<CodeSet> { @Override protected CodeSet 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 code set definition: " + line); } final int secondSpace = line.indexOf(' ', firstSpace + 1); if (secondSpace < 0) { return new CodeSet(Integer.parseInt(line.substring(firstSpace + 1))); } final int codeSet = Integer.parseInt(line.substring(firstSpace + 1, secondSpace)); final String description = line.substring(secondSpace + 1); return new CodeSet(codeSet, description); } finally { point.collect(); } }  }
CodeSetParser extends AbstractMultiTagParser<CodeSet> { @Override protected CodeSet 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 code set definition: " + line); } final int secondSpace = line.indexOf(' ', firstSpace + 1); if (secondSpace < 0) { return new CodeSet(Integer.parseInt(line.substring(firstSpace + 1))); } final int codeSet = Integer.parseInt(line.substring(firstSpace + 1, secondSpace)); final String description = line.substring(secondSpace + 1); return new CodeSet(codeSet, description); } finally { point.collect(); } }   }
CodeSetParser extends AbstractMultiTagParser<CodeSet> { @Override protected CodeSet 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 code set definition: " + line); } final int secondSpace = line.indexOf(' ', firstSpace + 1); if (secondSpace < 0) { return new CodeSet(Integer.parseInt(line.substring(firstSpace + 1))); } final int codeSet = Integer.parseInt(line.substring(firstSpace + 1, secondSpace)); final String description = line.substring(secondSpace + 1); return new CodeSet(codeSet, description); } finally { point.collect(); } }    }