diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-03-26 09:27:45 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-03-26 09:27:45 +0000 |
| commit | abbcc3915fa783c648436ef52e15da923a246dd1 (patch) | |
| tree | 2db501fd1a82dc608217623cc53b8a6b13f71bb5 /src/test/java/org/zwobble/mammoth/tests/DocumentToHtmlTests.java | |
| parent | 55ec6fed7278825bee4b6db24965b69b9c496ed5 (diff) | |
Lazily combine warnings in results
Diffstat (limited to 'src/test/java/org/zwobble/mammoth/tests/DocumentToHtmlTests.java')
| -rw-r--r-- | src/test/java/org/zwobble/mammoth/tests/DocumentToHtmlTests.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/DocumentToHtmlTests.java b/src/test/java/org/zwobble/mammoth/tests/DocumentToHtmlTests.java index 0783ac2..fb8d2a5 100644 --- a/src/test/java/org/zwobble/mammoth/tests/DocumentToHtmlTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/DocumentToHtmlTests.java @@ -1,5 +1,6 @@ package org.zwobble.mammoth.tests; +import org.hamcrest.Matcher; import org.junit.Test; import org.zwobble.mammoth.internal.DocumentToHtml; import org.zwobble.mammoth.internal.DocumentToHtmlOptions; @@ -21,11 +22,11 @@ import static org.hamcrest.MatcherAssert.assertThat; 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.util.MammothLists.list; import static org.zwobble.mammoth.internal.util.MammothMaps.map; import static org.zwobble.mammoth.internal.util.MammothSets.set; import static org.zwobble.mammoth.tests.DeepReflectionMatcher.deepEquals; +import static org.zwobble.mammoth.tests.ResultMatchers.isInternalSuccess; import static org.zwobble.mammoth.tests.documents.DocumentElementMakers.*; public class DocumentToHtmlTests { @@ -41,7 +42,7 @@ public class DocumentToHtmlTests { DocumentToHtmlOptions options = DocumentToHtmlOptions.DEFAULT.preserveEmptyParagraphs(); assertThat( DocumentToHtml.convertToHtml(make(a(PARAGRAPH)), options), - deepEquals(success(list(Html.element("p", list(Html.FORCE_WRITE)))))); + isSuccess(list(Html.element("p", list(Html.FORCE_WRITE))))); } @Test @@ -307,7 +308,7 @@ public class DocumentToHtmlTests { DocumentToHtmlOptions options = DocumentToHtmlOptions.DEFAULT .idPrefix("doc-42-"); InternalResult<List<HtmlNode>> result = DocumentToHtml.convertToHtml(document, options); - assertThat(result.getWarnings(), hasSize(0)); + assertThat(result.getWarnings(), emptyIterable()); return result.getValue(); } @@ -317,7 +318,7 @@ public class DocumentToHtmlTests { private List<HtmlNode> convertToHtml(DocumentElement element, StyleMap styleMap) { InternalResult<List<HtmlNode>> result = convertToHtmlResult(element, styleMap); - assertThat(result.getWarnings(), hasSize(0)); + assertThat(result.getWarnings(), emptyIterable()); return result.getValue(); } @@ -331,4 +332,8 @@ public class DocumentToHtmlTests { .addStyleMap(styleMap); return DocumentToHtml.convertToHtml(element, options); } + + private Matcher<? super InternalResult<List<HtmlNode>>> isSuccess(List<HtmlNode> expected) { + return isInternalSuccess(deepEquals(expected)); + } } |
