“Named Destinations” are seldom a test goal, because until now no test tool is been available which could compare named destinations. With PDFUnit you can verify that two documents have the same named destinations.
A simple test is to compare the number of “Named Destinations” in two documents:
@Test public void compareNumberOfNamedDestinations() throws Exception { String filenameTest = "documentUnderTest.pdf"; String filenameReference = "reference.pdf"; AssertThat.document(filenameTest) .and(filenameReference) .haveSameNumberOfNamedDestinations() ; }
If the names of 'Named Destinations' have to be equal for two documents, the following test can be used:
@Test public void compareNamedDestinations() throws Exception { String filenameTest = "documentUnderTest.pdf"; String filenameReference = "reference.pdf"; AssertThat.document(filenameTest) .and(filenameReference) .haveSameNamedDestinations() ; }