diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-02-24 21:11:14 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-02-24 21:11:14 +0000 |
| commit | cc66aa555d68eb33dfceb052e5dc37284e5080bd (patch) | |
| tree | 8b5aa764cefaa4ff8f560b9d18080cd76b8cd5b0 /src/test/java/org/zwobble | |
| parent | d1783e7eaf147217d0ffc5c91f007bc9870cd879 (diff) | |
Use raw Strings instead of Warnings
Diffstat (limited to 'src/test/java/org/zwobble')
3 files changed, 12 insertions, 15 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java b/src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java index 526c078..befba22 100644 --- a/src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/DocumentConverterTests.java @@ -22,11 +22,10 @@ import static org.hamcrest.Matchers.*; import static org.zwobble.mammoth.internal.documents.VerticalAlignment.SUBSCRIPT; import static org.zwobble.mammoth.internal.documents.VerticalAlignment.SUPERSCRIPT; import static org.zwobble.mammoth.internal.results.InternalResult.success; -import static org.zwobble.mammoth.internal.results.Warning.warning; -import static org.zwobble.mammoth.tests.DeepReflectionMatcher.deepEquals; -import static org.zwobble.mammoth.tests.documents.DocumentElementMakers.*; import static org.zwobble.mammoth.internal.util.MammothLists.list; import static org.zwobble.mammoth.internal.util.MammothMaps.map; +import static org.zwobble.mammoth.tests.DeepReflectionMatcher.deepEquals; +import static org.zwobble.mammoth.tests.documents.DocumentElementMakers.*; public class DocumentConverterTests { // TODO: styles (paragraph, run) @@ -80,7 +79,7 @@ public class DocumentConverterTests { deepEquals(new InternalResult<>( list(Html.element("p")), - list(warning("Unrecognised paragraph style: Tips Paragraph (Style ID: TipsParagraph)"))))); + list("Unrecognised paragraph style: Tips Paragraph (Style ID: TipsParagraph)")))); } @Test @@ -107,7 +106,7 @@ public class DocumentConverterTests { deepEquals(new InternalResult<>( list(Html.text("Hello")), - list(warning("Unrecognised run style: Tips Run (Style ID: TipsRun)"))))); + list("Unrecognised run style: Tips Run (Style ID: TipsRun)")))); } @Test diff --git a/src/test/java/org/zwobble/mammoth/tests/MammothTests.java b/src/test/java/org/zwobble/mammoth/tests/MammothTests.java index e8287e8..bc997a2 100644 --- a/src/test/java/org/zwobble/mammoth/tests/MammothTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/MammothTests.java @@ -97,7 +97,7 @@ public class MammothTests { allOf( hasProperty("value", equalTo("")), hasProperty("warnings", contains( - hasProperty("message", startsWith("could not open external image 'tiny-picture.png': path of document is unknown, but is required for relative URI")))))); + startsWith("could not open external image 'tiny-picture.png': path of document is unknown, but is required for relative URI"))))); } finally { tempDirectory.toFile().delete(); } @@ -114,7 +114,7 @@ public class MammothTests { allOf( hasProperty("value", equalTo("")), hasProperty("warnings", contains( - hasProperty("message", startsWith("could not open external image 'tiny-picture.png'")))))); + startsWith("could not open external image 'tiny-picture.png'"))))); } finally { tempDirectory.toFile().delete(); } 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 4c9d621..049db81 100644 --- a/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlTests.java @@ -8,7 +8,6 @@ import org.junit.Test; import org.zwobble.mammoth.internal.documents.*; import org.zwobble.mammoth.internal.docx.*; import org.zwobble.mammoth.internal.results.InternalResult; -import org.zwobble.mammoth.internal.results.Warning; import org.zwobble.mammoth.tests.DeepReflectionMatcher; import org.zwobble.mammoth.internal.xml.XmlElement; import org.zwobble.mammoth.internal.xml.XmlNode; @@ -29,7 +28,6 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasProperty; import static org.zwobble.mammoth.internal.documents.NoteReference.endnoteReference; import static org.zwobble.mammoth.internal.documents.NoteReference.footnoteReference; -import static org.zwobble.mammoth.internal.results.Warning.warning; import static org.zwobble.mammoth.tests.DeepReflectionMatcher.deepEquals; import static org.zwobble.mammoth.tests.documents.DocumentElementMakers.*; import static org.zwobble.mammoth.tests.docx.BodyXmlReaderMakers.*; @@ -94,7 +92,7 @@ public class BodyXmlTests { read(a(bodyReader), element), isResult( hasStyle(Optional.of(new Style("Heading1", Optional.empty()))), - list(warning("Paragraph style with ID Heading1 was referenced but not defined in the document")))); + list("Paragraph style with ID Heading1 was referenced but not defined in the document"))); } @Test @@ -183,7 +181,7 @@ public class BodyXmlTests { 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")))); + list("Run style with ID Heading1Char was referenced but not defined in the document"))); } @Test @@ -311,7 +309,7 @@ public class BodyXmlTests { assertThat( readAll(a(bodyReader), element), - isResult(equalTo(list()), list(warning("Unsupported break type: page")))); + isResult(equalTo(list()), list("Unsupported break type: page"))); } @Test @@ -477,7 +475,7 @@ public class BodyXmlTests { assertThat( result, - hasProperty("warnings", deepEquals(list(warning("Image of type image/x-emf is unlikely to display in web browsers"))))); + hasProperty("warnings", deepEquals(list("Image of type image/x-emf is unlikely to display in web browsers")))); } @Test @@ -583,7 +581,7 @@ public class BodyXmlTests { XmlElement element = element("w:huh"); assertThat( readAll(a(bodyReader), element), - isResult(equalTo(list()), list(warning("An unrecognised element was ignored: w:huh")))); + isResult(equalTo(list()), list("An unrecognised element was ignored: w:huh"))); } @Test @@ -654,7 +652,7 @@ public class BodyXmlTests { return hasProperty("numbering", deepEquals(expected)); } - private <T> Matcher<InternalResult<? extends T>> isResult(Matcher<T> valueMatcher, List<Warning> warnings) { + private <T> Matcher<InternalResult<? extends T>> isResult(Matcher<T> valueMatcher, List<String> warnings) { return Matchers.allOf( hasProperty("value", valueMatcher), hasProperty("warnings", deepEquals(warnings))); |
