diff options
Diffstat (limited to 'src/test/java/org/zwobble/mammoth/tests/MammothTests.java')
| -rw-r--r-- | src/test/java/org/zwobble/mammoth/tests/MammothTests.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/MammothTests.java b/src/test/java/org/zwobble/mammoth/tests/MammothTests.java index 85a20ce..a072185 100644 --- a/src/test/java/org/zwobble/mammoth/tests/MammothTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/MammothTests.java @@ -121,6 +121,29 @@ public class MammothTests { } @Test + public void warnIfDocumentHasImagesStoredOutsideOfDocumentWhenExternalFileAccessIsDisabled() throws IOException { + Path tempDirectory = Files.createTempDirectory("mammoth-"); + try { + Path documentPath = tempDirectory.resolve("external-picture.docx"); + Files.copy(TestData.file("external-picture.docx").toPath(), documentPath); + Files.copy(TestData.file("tiny-picture.png").toPath(), tempDirectory.resolve("tiny-picture.png")); + assertThat( + new DocumentConverter() + .disableExternalFileAccess() + .convertToHtml(documentPath.toFile()), + allOf( + hasProperty("value", equalTo("")), + hasProperty("warnings", contains( + equalTo("could not open external image 'tiny-picture.png': external file access is disabled") + )) + ) + ); + } finally { + tempDirectory.toFile().delete(); + } + } + + @Test public void warnIfImagesStoredOutsideOfDocumentAreNotFound() throws IOException { Path tempDirectory = Files.createTempDirectory("mammoth-"); try { |
