diff options
Diffstat (limited to 'src/test/java/org')
| -rw-r--r-- | src/test/java/org/zwobble/mammoth/tests/MammothTests.java | 18 |
1 files changed, 18 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 e778630..603d39a 100644 --- a/src/test/java/org/zwobble/mammoth/tests/MammothTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/MammothTests.java @@ -9,6 +9,7 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import static org.hamcrest.Matchers.*; import static org.junit.Assert.assertThat; import static org.zwobble.mammoth.results.Result.success; import static org.zwobble.mammoth.tests.DeepReflectionMatcher.deepEquals; @@ -85,6 +86,23 @@ public class MammothTests { } @Test + public void warnIfImagesStoredOutsideOfDocumentAreNotFound() throws IOException { + Path tempDirectory = Files.createTempDirectory("mammoth-"); + try { + Path documentPath = tempDirectory.resolve("external-picture.docx"); + Files.copy(TestData.file("external-picture.docx").toPath(), documentPath); + assertThat( + Mammoth.convertToHtml(documentPath.toFile()), + allOf( + hasProperty("value", equalTo("")), + hasProperty("warnings", contains( + hasProperty("message", startsWith("could not open external image 'tiny-picture.png'")))))); + } finally { + tempDirectory.toFile().delete(); + } + } + + @Test public void contentTypesAreRead() { assertThat( convertToHtml("tiny-picture-custom-content-type.docx"), |
