@Test(expected = TaskIOException.class)
public void openDocumentTwice_streamSource_not_possible() throws TaskIOException, IOException {

    PdfStreamSource source = PdfStreamSource.newInstanceNoPassword(
            getClass().getClassLoader().getResourceAsStream("pdf/test_file.pdf"), "my source");
    try(PDDocumentHandler handler = new DefaultPdfSourceOpener().open(source)) {
        assertNotNull(handler.getUnderlyingPDDocument());
    }
    try(PDDocumentHandler handler = new DefaultPdfSourceOpener().open(source)) {
        // exception expected
        fail("Exception was expected");
    }
}