@Test(expected = IllegalArgumentException.class) public void testAppendItemInvalidString() { new TableOfContentsCreator(new MergeParameters(), new PDDocument()).appendItem(" ", 10, new PDPage()); }
public void appendItem(String text, long pageNumber, PDPage page) { requireNotBlank(text, "ToC item cannot be blank"); requireArg(pageNumber > 0, "ToC item cannot point to a negative page"); requireNotNullArg(page, "ToC page cannot be null"); if (shouldGenerateToC()) { items.add(new ToCItem(text, pageNumber, linkAnnotationFor(page))); recalculateDimensions(); } }
TableOfContentsCreator { public void appendItem(String text, long pageNumber, PDPage page) { requireNotBlank(text, "ToC item cannot be blank"); requireArg(pageNumber > 0, "ToC item cannot point to a negative page"); requireNotNullArg(page, "ToC page cannot be null"); if (shouldGenerateToC()) { items.add(new ToCItem(text, pageNumber, linkAnnotationFor(page))); recalculateDimensions(); } } }
TableOfContentsCreator { public void appendItem(String text, long pageNumber, PDPage page) { requireNotBlank(text, "ToC item cannot be blank"); requireArg(pageNumber > 0, "ToC item cannot point to a negative page"); requireNotNullArg(page, "ToC page cannot be null"); if (shouldGenerateToC()) { items.add(new ToCItem(text, pageNumber, linkAnnotationFor(page))); recalculateDimensions(); } } TableOfContentsCreator(MergeParameters params, PDDocument document); }
TableOfContentsCreator { public void appendItem(String text, long pageNumber, PDPage page) { requireNotBlank(text, "ToC item cannot be blank"); requireArg(pageNumber > 0, "ToC item cannot point to a negative page"); requireNotNullArg(page, "ToC page cannot be null"); if (shouldGenerateToC()) { items.add(new ToCItem(text, pageNumber, linkAnnotationFor(page))); recalculateDimensions(); } } 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(); }
TableOfContentsCreator { public void appendItem(String text, long pageNumber, PDPage page) { requireNotBlank(text, "ToC item cannot be blank"); requireArg(pageNumber > 0, "ToC item cannot point to a negative page"); requireNotNullArg(page, "ToC page cannot be null"); if (shouldGenerateToC()) { items.add(new ToCItem(text, pageNumber, linkAnnotationFor(page))); recalculateDimensions(); } } 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();  }