### Question:
WikiParser extends BrainParser { @Override public Note parse(final InputStream inputStream) throws IOException { reset(); BufferedReader bufferedReader = createReader(inputStream); while ((currentLine = bufferedReader.readLine()) != null) { parseLine(); } if (currentLineIsInPage && !isEmptyPage(currentValue)) { root.getChildren().get(0).setText(currentValue); } return root; }  void setUseCanonicalFormat(boolean useCanonicalFormat); @Override Note parse(final InputStream inputStream);  }### Answer:
@Test public void testExample1() throws Exception { List<Note> notes = wikiParser.parse( getClass().getResourceAsStream("wiki-example-1.txt")).getChildren(); assertEquals(7, notes.size()); Note indentation = notes.get(1); assertNull(indentation.getId()); assertEquals("indentation", indentation.getTitle()); assertEquals("and this", indentation.getChildren() .get(2).getChildren() .get(0).getChildren() .get(0).getChildren() .get(0).getTitle()); Note atts = notes.get(3); assertEquals("http: assertEquals(0.75f, atts.getWeight()); Note ws = notes.get(4); assertEquals(4, ws.getChildren().size()); assertEquals("leading and trailing whitespace are ignored", ws.getChildren().get(2).getTitle()); Note ids = notes.get(5); assertEquals("ids", ids.getTitle()); assertEquals("0txXBm", ids.getChildren().get(0).getId()); assertEquals("cE85nD", ids.getChildren().get(1).getId()); }
@Test public void testExample2() throws Exception { Note root = wikiParser.parse(getClass().getResourceAsStream("wiki-example-2.txt")); assertEquals("http: assertEquals(1.0f, root.getWeight()); assertEquals(DefaultSources.PUBLIC, root.getSource()); assertEquals(0.5f, root.getPriority()); assertEquals(1, root.getChildren().size()); assertEquals(1, root.getChildren().get(0).getChildren().size()); }