aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/zwobble
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-02-16 22:01:46 +0000
committerMichael Williamson <mike@zwobble.org>2016-02-16 22:01:46 +0000
commit6181e50cc197f5f9a71374efe256410e1eceffe3 (patch)
tree04178188820ed3b5865dfee48fdf92d159960e2f /src/test/java/org/zwobble
parent97d89445e8a75c3e1dc596878f1a9a944f9317d5 (diff)
Wire up style reading
Diffstat (limited to 'src/test/java/org/zwobble')
-rw-r--r--src/test/java/org/zwobble/mammoth/tests/MammothTests.java5
-rw-r--r--src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlReaderMakers.java3
-rw-r--r--src/test/java/org/zwobble/mammoth/tests/docx/InMemoryDocxFile.java6
3 files changed, 7 insertions, 7 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/MammothTests.java b/src/test/java/org/zwobble/mammoth/tests/MammothTests.java
index 2fd6ba0..7e326f6 100644
--- a/src/test/java/org/zwobble/mammoth/tests/MammothTests.java
+++ b/src/test/java/org/zwobble/mammoth/tests/MammothTests.java
@@ -6,7 +6,6 @@ import org.zwobble.mammoth.results.Result;
import java.io.File;
-import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.zwobble.mammoth.results.Result.success;
import static org.zwobble.mammoth.tests.DeepReflectionMatcher.deepEquals;
@@ -15,8 +14,8 @@ public class MammothTests {
@Test
public void emptyParagraphsAreIgnoredByDefault() {
assertThat(
- convertToHtml("empty.docx").getValue(),
- is(""));
+ convertToHtml("empty.docx"),
+ deepEquals(success("")));
}
@Test
diff --git a/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlReaderMakers.java b/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlReaderMakers.java
index f19f505..bb77b01 100644
--- a/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlReaderMakers.java
+++ b/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlReaderMakers.java
@@ -6,6 +6,7 @@ import org.zwobble.mammoth.docx.*;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Optional;
import static com.natpryce.makeiteasy.Property.newProperty;
@@ -25,7 +26,7 @@ public class BodyXmlReaderMakers {
propertyLookup.valueOf(CONTENT_TYPES, ContentTypes.DEFAULT),
propertyLookup.valueOf(DOCX_FILE, new DocxFile() {
@Override
- public InputStream getInputStream(String name) throws IOException {
+ public Optional<InputStream> tryGetInputStream(String name) throws IOException {
throw new UnsupportedOperationException();
}
diff --git a/src/test/java/org/zwobble/mammoth/tests/docx/InMemoryDocxFile.java b/src/test/java/org/zwobble/mammoth/tests/docx/InMemoryDocxFile.java
index 2ed5e27..4aef42e 100644
--- a/src/test/java/org/zwobble/mammoth/tests/docx/InMemoryDocxFile.java
+++ b/src/test/java/org/zwobble/mammoth/tests/docx/InMemoryDocxFile.java
@@ -17,9 +17,9 @@ public class InMemoryDocxFile implements DocxFile {
}
@Override
- public InputStream getInputStream(String name) throws IOException {
- String value = Optional.ofNullable(entries.get(name)).get();
- return new ByteArrayInputStream(value.getBytes(StandardCharsets.UTF_8));
+ public Optional<InputStream> tryGetInputStream(String name) throws IOException {
+ return Optional.ofNullable(entries.get(name))
+ .map(value -> new ByteArrayInputStream(value.getBytes(StandardCharsets.UTF_8)));
}
@Override