diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-04-30 16:02:45 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-04-30 16:02:45 +0100 |
| commit | 2cbb4869f34563ea686a3275ba7b2afce99efa14 (patch) | |
| tree | 94d6df4ae3b1bd983e810973baa0a64e0b611412 /src/test/java/org/zwobble/mammoth | |
| parent | cd0383a5cdb303a552ef13fc3c70261d36823ba8 (diff) | |
Use specialised exception type for parse errors
Diffstat (limited to 'src/test/java/org/zwobble/mammoth')
| -rw-r--r-- | src/test/java/org/zwobble/mammoth/tests/MammothTests.java | 12 |
1 files changed, 12 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 b2661b0..4f4c9fd 100644 --- a/src/test/java/org/zwobble/mammoth/tests/MammothTests.java +++ b/src/test/java/org/zwobble/mammoth/tests/MammothTests.java @@ -3,6 +3,7 @@ package org.zwobble.mammoth.tests; import org.junit.Test; import org.zwobble.mammoth.DocumentConverter; import org.zwobble.mammoth.Result; +import org.zwobble.mammoth.internal.styles.parsing.ParseException; import java.io.File; import java.io.IOException; @@ -15,6 +16,7 @@ import static org.junit.Assert.assertThat; import static org.zwobble.mammoth.internal.util.Lists.list; import static org.zwobble.mammoth.tests.ResultMatchers.isResult; import static org.zwobble.mammoth.tests.ResultMatchers.isSuccess; +import static org.zwobble.mammoth.tests.util.MammothAsserts.assertThrows; public class MammothTests { @Test @@ -190,6 +192,16 @@ public class MammothTests { } @Test + public void errorIsRaisedIfStyleMapCannotBeParsed() throws IOException { + RuntimeException exception = assertThrows( + ParseException.class, + () -> new DocumentConverter().addStyleMap("p =>\np[style-name=] =>")); + assertThat( + exception.getMessage(), + equalTo("expected token of type STRING but was of type CLOSE_SQUARE_BRACKET")); + } + + @Test public void canDisableDefaultStyleMap() throws IOException { assertThat( convertToHtml("simple-list.docx", mammoth -> mammoth.disableDefaultStyleMap()), |
