FileDocument extends CommonDocument { public boolean exists() { return file.exists(); } FileDocument(final String path);  FileDocument(final File file); @Override InputStream openStream(); boolean exists(); File getFile(); @Override String getAbsolutePath();  }
@Test public void testFile() throws IOException { FileDocument doc = new FileDocument("src/test/resources/AdobeCA.p7c"); assertNotNull(doc); assertTrue(doc.exists()); assertEquals("AdobeCA.p7c", doc.getName()); assertEquals(MimeType.BINARY, doc.getMimeType()); assertEquals("xF8SpcLlrd4Bhl1moh4Ciz+Rq/PImaChEl/tyGTZyPM=", doc.getDigest(DigestAlgorithm.SHA256)); assertEquals("xF8SpcLlrd4Bhl1moh4Ciz+Rq/PImaChEl/tyGTZyPM=", doc.getDigest(DigestAlgorithm.SHA256)); String path = "target/testFileDocument"; doc.save(path); File file = new File(path); assertTrue(file.exists()); }