### Question:
ReVIEWParser extends LineParser { ReVIEWBlock parseBlock(Line line) { ReVIEWBlock block = new ReVIEWBlock(); String text = line.getText(); int openIdx = text.indexOf("["); if (openIdx > 0) { block.type = text.substring(2, openIdx); int closeIdx = text.indexOf("]"); while(closeIdx > 0) { block.properties.add(text.substring(openIdx+1, closeIdx)); openIdx = text.indexOf("[", openIdx+1); closeIdx = text.indexOf("]", closeIdx+1); } } else { int leftBracePosition = text.indexOf("{"); block.type = text.substring(2, leftBracePosition > 0 ? leftBracePosition : text.length() - 1); } if (text.indexOf("{") > 0) { block.isOpen = true; } return block; }    }### Answer:
@Test void ParseBlock() throws Exception { String sample = " ReVIEWParser parser = new ReVIEWParser(); ReVIEWParser.ReVIEWBlock block = parser.parseBlock(new ReVIEWLine(sample, 0)); assertEquals("list", block.type); assertEquals(2, block.properties.size()); assertEquals("yml_sample", block.properties.get(0)); assertEquals("my.yml", block.properties.get(1)); assertTrue(block.isOpen); }
@Test void ParseBlockWithoutProperties() throws Exception { String sample = " ReVIEWParser parser = new ReVIEWParser(); ReVIEWParser.ReVIEWBlock block = parser.parseBlock(new ReVIEWLine(sample, 0)); assertEquals("lead", block.type); assertEquals(0, block.properties.size()); assertTrue(block.isOpen); }