diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-02-13 18:55:28 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-02-13 18:55:28 +0000 |
| commit | a504d39d40597978f2c403c6dce2408421e1eaa2 (patch) | |
| tree | 0d73e5e51100746351fd851574f4e4dfb40d7715 /src | |
| parent | 3153e2a5cf92729d1f62b6c8e380405ccf5ff238 (diff) | |
Check warning is produced when failing to find run style
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java b/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java index e734d42..49d906f 100644 --- a/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java @@ -79,7 +79,7 @@ public class BodyXmlTests { } @Test - public void paragraphHasStyleIdReadFromParagraphPropertiesIfPresent() { + public void warningIsEmittedWhenParagraphStyleCannotBeFound() { XmlElement element = paragraphXml(list( element("w:pPr", list( element("w:pStyle", map("w:val", "Heading1")))))); @@ -166,6 +166,19 @@ public class BodyXmlTests { hasStyle(Optional.of(style))); } + @Test + public void warningIsEmittedWhenRunStyleCannotBeFound() { + XmlElement element = runXml(list( + element("w:rPr", list( + element("w:rStyle", map("w:val", "Heading1Char")))))); + + assertThat( + read(a(bodyReader), element), + isResult( + hasStyle(Optional.of(new Style("Heading1Char", Optional.empty()))), + list(warning("Run style with ID Heading1Char was referenced but not defined in the document")))); + } + private static DocumentElement readSuccess(Maker<BodyXmlReader> reader, XmlElement element) { Result<DocumentElement> result = read(reader, element); assertThat(result.getWarnings(), deepEquals(list())); |
