public String toString(OrgParserSettings settings) { StringBuilder str = new StringBuilder(); OrgParserWriter parserWriter = new OrgParserWriter(settings); str.append(parserWriter.whiteSpacedFilePreface(file.getPreface())); for (OrgNodeInList nodeInList : headsInList) { str.append(parserWriter.whiteSpacedHead(nodeInList, file.getSettings().isIndented())); } return str.toString(); } }
@Test public void testNotIndented() throws IOException { OrgParsedFile file = parserBuilder.setInput("* TODO Title\nSCHEDULED: <2015-02-11 Wed +1d>").build().parse(); Assert.assertFalse(file.getFile().getSettings().isIndented()); }
@Test public void testIndentedAfterCounting() throws IOException { OrgParsedFile file = parserBuilder.setInput("* TODO Title\n SCHEDULED: <2015-02-11 Wed +1d>\nDEADLINE: <2015-02-08 Sun>\n CLOSED: [2015-02-08 Sun]").build().parse(); Assert.assertTrue(file.getFile().getSettings().isIndented()); }
@Test public void testNotIndentedAfterCounting() throws IOException { OrgParsedFile file = parserBuilder.setInput("* TODO Title\nSCHEDULED: <2015-02-11 Wed +1d>\nDEADLINE: <2015-02-08 Sun>\n CLOCK: [2015-02-07 Sat 20:47]--[2015-02-07 Sat 20:47] => 0:00").build().parse(); Assert.assertFalse(file.getFile().getSettings().isIndented()); }
@Test public void testIndented() throws IOException { OrgParsedFile file = parserBuilder.setInput("* TODO Title\n SCHEDULED: <2015-02-11 Wed +1d>").build().parse(); Assert.assertTrue(file.getFile().getSettings().isIndented()); }