4.17. More Comparisons

In the previous chapters a lot of examples show how to compare various parts of two PDF documents. But PDFUnit provides more methods for comparing PDF. The following list shows the remaining methods. They should be self explanatory:

// Various methods, comparing PDF. Not described before:

.haveSameJavaScript()
.haveSameKeywords()                       
.haveSameLanguageInfo()
.haveSameLayerNames()
.haveSameTaggingInfo()

Concatenation of Test Methods

All methods can be concatenated:

@Test
public void haveSameAuthorTitle() throws Exception {
  String filenameTest = "documentUnderTest.pdf";
  String filenameReference = "reference.pdf";
  
  AssertThat.document(filenameTest)
            .and(filenameReference)
            .haveSameAuthor()
            .haveSameTitle()
  ;
}

This example is only a syntax demo. In real projects you should separate the test into two tests, each with a meaningful name.