### Question:
WikiPrinter { public void setUseCanonicalFormat(boolean useCanonicalFormat) { this.useCanonicalFormat = useCanonicalFormat; }  void setUseCanonicalFormat(boolean useCanonicalFormat); void print(final Note note,
                      final OutputStream out,
                      final boolean withProperties);  }### Answer:
@Test public void noPageUnlessUsingCanonicalFormat() throws IOException { wikiPrinter.setUseCanonicalFormat(false); Note note = new Note(); note.setId("123"); note.setTitle("Arthur Dent"); note.setText("He's a jerk.\nA complete kneebiter."); assertEquals("* :123: Arthur Dent\n", toWikiText(note)); }
@Test public void pageFollowsChildrenWhichFollowProperties() throws Exception { wikiPrinter.setUseCanonicalFormat(true); Note note = new Note(); note.setId("123"); note.setTitle("Arthur Dent"); note.setAlias("http: note.setText("He's a jerk.\nA complete kneebiter."); Note child = new Note(); child.setId("abc"); note.addChild(child); assertEquals("* :123: Arthur Dent\n" + " @alias http: " * :abc: \n" + "\n" + "He's a jerk.\n" + "A complete kneebiter.", toWikiText(note)); }
@Test public void pageIsOptional() throws Exception { wikiPrinter.setUseCanonicalFormat(true); Note note = new Note(); note.setId("123"); note.setTitle("Arthur Dent"); note.setText(""); assertEquals("* :123: Arthur Dent\n", toWikiText(note)); }
@Test public void emptyPageIsIgnored() throws Exception { wikiPrinter.setUseCanonicalFormat(true); Note note = new Note(); note.setId("123"); note.setTitle("Arthur Dent"); note.setText(" \n "); assertEquals("* :123: Arthur Dent\n", toWikiText(note)); }
@Test public void inlinePagesAreSupported() throws Exception { wikiPrinter.setUseCanonicalFormat(true); Note note = new Note(); note.setTitle("Life, the Universe, and Everything"); note.setText("The regular early morning yell of horror was the sound of Arthur Dent waking\n" + "up and suddenly remembering where he was."); String text = "* Life, the Universe, and Everything\n" + "\n" + "The regular early morning yell of horror was the sound of Arthur Dent waking\n" + "up and suddenly remembering where he was."; assertEquals(text, toWikiText(note)); }