The following code shows how to use multiple documents in one test.
@Test public void textInMultipleDocuments() throws Exception { String fileName1 = "document_en.pdf"; String fileName2 = "document_es.pdf"; String fileName3 = "document_de.pdf"; File file1 = new File(fileName1); File file2 = new File(fileName2); File file3 = new File(fileName3); File[] files = {file1, file2, file3}; String expectedDate = "28.09.2014"; String expectedDocumentID = "XX-123"; AssertThat.eachDocument(files) .restrictedTo(FIRST_PAGE) .hasText() .containing(expectedDate) .containing(expectedDocumentID) ; }
The PDF-documents are passed to the method eachDocument()
as a String[]
. The types File[]
,
InputStream[]
, and URL[]
can also be used.