aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/zwobble/mammoth/docx/Styles.java3
-rw-r--r--src/test/java/org/zwobble/mammoth/tests/documents/DocumentElementMakers.java13
-rw-r--r--src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlReaderMakers.java11
3 files changed, 9 insertions, 18 deletions
diff --git a/src/main/java/org/zwobble/mammoth/docx/Styles.java b/src/main/java/org/zwobble/mammoth/docx/Styles.java
index d2311fe..3ee7372 100644
--- a/src/main/java/org/zwobble/mammoth/docx/Styles.java
+++ b/src/main/java/org/zwobble/mammoth/docx/Styles.java
@@ -1,11 +1,14 @@
package org.zwobble.mammoth.docx;
+import com.google.common.collect.ImmutableMap;
import org.zwobble.mammoth.documents.Style;
import java.util.Map;
import java.util.Optional;
public class Styles {
+ public static final Styles EMPTY = new Styles(ImmutableMap.of(), ImmutableMap.of());
+
private final Map<String, Style> paragraphStyles;
private final Map<String, Style> characterStyles;
diff --git a/src/test/java/org/zwobble/mammoth/tests/documents/DocumentElementMakers.java b/src/test/java/org/zwobble/mammoth/tests/documents/DocumentElementMakers.java
index f2d5317..0d83882 100644
--- a/src/test/java/org/zwobble/mammoth/tests/documents/DocumentElementMakers.java
+++ b/src/test/java/org/zwobble/mammoth/tests/documents/DocumentElementMakers.java
@@ -3,7 +3,6 @@ package org.zwobble.mammoth.tests.documents;
import com.google.common.collect.ImmutableList;
import com.natpryce.makeiteasy.Instantiator;
import com.natpryce.makeiteasy.Property;
-import com.natpryce.makeiteasy.PropertyLookup;
import org.zwobble.mammoth.documents.DocumentElement;
import org.zwobble.mammoth.documents.HasChildren;
import org.zwobble.mammoth.documents.Paragraph;
@@ -16,12 +15,8 @@ import static com.natpryce.makeiteasy.Property.newProperty;
public class DocumentElementMakers {
public static final Property<HasChildren, List<DocumentElement>> CHILDREN = newProperty();
- public 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()));
- }
- };
+ public static final Instantiator<Paragraph> PARAGRAPH =
+ propertyLookup -> new Paragraph(
+ Optional.empty(),
+ propertyLookup.valueOf(CHILDREN, ImmutableList.of()));
}
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 a0748b9..6dafdee 100644
--- a/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlReaderMakers.java
+++ b/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlReaderMakers.java
@@ -1,9 +1,7 @@
package org.zwobble.mammoth.tests.docx;
-import com.google.common.collect.ImmutableMap;
import com.natpryce.makeiteasy.Instantiator;
import com.natpryce.makeiteasy.Property;
-import com.natpryce.makeiteasy.PropertyLookup;
import org.zwobble.mammoth.docx.BodyXmlReader;
import org.zwobble.mammoth.docx.Styles;
@@ -12,11 +10,6 @@ import static com.natpryce.makeiteasy.Property.newProperty;
public class BodyXmlReaderMakers {
public static final Property<BodyXmlReader, Styles> STYLES = newProperty();
- public static final Instantiator<BodyXmlReader> bodyReader = new Instantiator<BodyXmlReader>() {
- @Override
- public BodyXmlReader instantiate(PropertyLookup<BodyXmlReader> propertyLookup) {
- return new BodyXmlReader(
- propertyLookup.valueOf(STYLES, new Styles(ImmutableMap.of(), ImmutableMap.of())));
- }
- };
+ public static final Instantiator<BodyXmlReader> bodyReader =
+ propertyLookup -> new BodyXmlReader(propertyLookup.valueOf(STYLES, Styles.EMPTY));
}