XviImporter extends Importer { public static List<String> parseBlockEntries(String content) { List<String> entries = new ArrayList<>(); Pattern pattern = Pattern.compile("\\{(.*?)\\}"); Matcher matcher = pattern.matcher(content); while (matcher.find()) { entries.add(matcher.group(1)); } return entries; }  Survey toSurvey(File file); static Sketch getSketch(File file); boolean canHandleFile(File file); Grid parseGrid(String contents); static Set<PathDetail> parseSketchlineBlock(double scale, String contents); static List<String> parseBlockEntries(String content); static PathDetail parseSketchEntry(double scale, String entry); static String getBlockContents(String text, String command);  }
@Test public void testParseBlockEntriesSingle() throws Exception { String simpleText = "{foo}"; List<String> contents = XviImporter.parseBlockEntries(simpleText); Assert.assertEquals("foo", contents.get(0)); }
@Test public void testParseBlockEntriesMultiple() throws Exception { String simpleText = "{foo}{bar}"; List<String> contents = XviImporter.parseBlockEntries(simpleText); Assert.assertEquals("foo", contents.get(0)); Assert.assertEquals("bar", contents.get(1)); }
@Test public void testParseBlockEntriesWithMultipleItems() throws Exception { String simpleText = "{foo extra}\n{bar more}"; List<String> contents = XviImporter.parseBlockEntries(simpleText); Assert.assertEquals("foo extra", contents.get(0)); Assert.assertEquals("bar more", contents.get(1)); }
@Test public void testParseBlockEntriesMultipleWithWhitespace() throws Exception { String simpleText = "\t{foo}\n {bar}"; List<String> contents = XviImporter.parseBlockEntries(simpleText); Assert.assertEquals("foo", contents.get(0)); Assert.assertEquals("bar", contents.get(1)); }