TableOfContentsCreator { public long tocNumberOfPages() { return tocNumberOfPages; } 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 testTocNumberOfPagesNoToc() { MergeParameters params = new MergeParameters(); params.setTableOfContentsPolicy(ToCPolicy.NONE); params.addInput(new PdfMergeInput(mock(PdfFileSource.class))); TableOfContentsCreator victim = new TableOfContentsCreator(params, new PDDocument()); assertEquals(0, victim.tocNumberOfPages()); }
@Test public void testTocNumberOfPages() { MergeParameters params = new MergeParameters(); params.setTableOfContentsPolicy(ToCPolicy.DOC_TITLES); params.addInput(new PdfMergeInput(mock(PdfFileSource.class))); TableOfContentsCreator victim = new TableOfContentsCreator(params, new PDDocument()); assertEquals(1, victim.tocNumberOfPages()); }
@Test public void testTocNumberOfPagesAddBlank() { MergeParameters params = new MergeParameters(); params.setBlankPageIfOdd(true); params.setTableOfContentsPolicy(ToCPolicy.DOC_TITLES); params.addInput(new PdfMergeInput(mock(PdfFileSource.class))); TableOfContentsCreator victim = new TableOfContentsCreator(params, new PDDocument()); assertEquals(2, victim.tocNumberOfPages()); }