aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/zwobble/mammoth/tests/docx/DocumentXmlTests.java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-01-03 12:03:09 +0000
committerMichael Williamson <mike@zwobble.org>2016-01-03 12:03:09 +0000
commitc740b5a709f66372631f762b55137db731d03793 (patch)
tree7d9c828de25193939debebd92cd656d1dfd2b644 /src/test/java/org/zwobble/mammoth/tests/docx/DocumentXmlTests.java
parentea37dde406b1c7fc35f72216882b7732d6ee5445 (diff)
Use make-it-easy to create paragraphs in tests
Diffstat (limited to 'src/test/java/org/zwobble/mammoth/tests/docx/DocumentXmlTests.java')
-rw-r--r--src/test/java/org/zwobble/mammoth/tests/docx/DocumentXmlTests.java26
1 files changed, 6 insertions, 20 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/docx/DocumentXmlTests.java b/src/test/java/org/zwobble/mammoth/tests/docx/DocumentXmlTests.java
index ffe2b2f..47e53fc 100644
--- a/src/test/java/org/zwobble/mammoth/tests/docx/DocumentXmlTests.java
+++ b/src/test/java/org/zwobble/mammoth/tests/docx/DocumentXmlTests.java
@@ -1,39 +1,25 @@
package org.zwobble.mammoth.tests.docx;
import com.google.common.collect.ImmutableList;
-import com.natpryce.makeiteasy.Instantiator;
-import com.natpryce.makeiteasy.Property;
-import com.natpryce.makeiteasy.PropertyLookup;
import org.junit.Test;
-import org.zwobble.mammoth.documents.*;
+import org.zwobble.mammoth.documents.Document;
+import org.zwobble.mammoth.documents.Run;
+import org.zwobble.mammoth.documents.Text;
import org.zwobble.mammoth.docx.BodyXmlReader;
import org.zwobble.mammoth.docx.DocumentXmlReader;
import org.zwobble.mammoth.xml.XmlElement;
import org.zwobble.mammoth.xml.XmlNodes;
-import java.util.List;
-import java.util.Optional;
-
import static com.natpryce.makeiteasy.MakeItEasy.*;
-import static com.natpryce.makeiteasy.Property.newProperty;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.zwobble.mammoth.tests.DeepReflectionMatcher.deepEquals;
+import static org.zwobble.mammoth.tests.documents.DocumentElementMakers.CHILDREN;
+import static org.zwobble.mammoth.tests.documents.DocumentElementMakers.PARAGRAPH;
import static org.zwobble.mammoth.xml.XmlNodes.element;
public class DocumentXmlTests {
private static final BodyXmlReader bodyReader = make(a(BodyXmlReaderMakers.bodyReader));
- private static final Property<HasChildren, List<DocumentElement>> CHILDREN = newProperty();
-
- private static final Instantiator<Paragraph> paragraph = new Instantiator<Paragraph>() {
- @Override
- public Paragraph instantiate(PropertyLookup<Paragraph> propertyLookup) {
- return new Paragraph(
- Optional.empty(),
- propertyLookup.valueOf(CHILDREN, ImmutableList.of()));
- }
- };
-
@Test
public void canReadTextWithinDocument() {
XmlElement documentElement = element("w:document", ImmutableList.of(
@@ -48,7 +34,7 @@ public class DocumentXmlTests {
assertThat(
document,
deepEquals(new Document(ImmutableList.of(
- make(a(paragraph, with(CHILDREN, ImmutableList.of(
+ make(a(PARAGRAPH, with(CHILDREN, ImmutableList.of(
new Run(ImmutableList.of(
new Text("Hello!")))))))))));
}