TableOfContentsCreator { public boolean hasToc() { return !items.isEmpty(); } TableOfContentsCreator(MergeParameters params, PDDocument document); void appendItem(String text, long pageNumber, PDPage page); void addToC(); void addToC(int beforePageNumber); boolean hasToc(); boolean shouldGenerateToC(); void pageSizeIfNotSet(PDRectangle pageSize); float getFontSize(); long tocNumberOfPages();  }
@Test public void testHasToc() { MergeParameters params = new MergeParameters(); params.setTableOfContentsPolicy(ToCPolicy.DOC_TITLES); TableOfContentsCreator victim = new TableOfContentsCreator(params, new PDDocument()); assertFalse(victim.hasToc()); victim.appendItem("text", 10, new PDPage()); assertTrue(victim.hasToc()); }