From 9db49ccb50b1d667caf80f5b09087af88f817b60 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 28 Aug 2016 22:03:18 +0100 Subject: Remove usage of make it easy for building body readers --- .../mammoth/tests/docx/BodyXmlReaderMakers.java | 33 +++++++++------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlReaderMakers.java') 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 e937acb..2fbd72c 100644 --- a/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlReaderMakers.java +++ b/src/test/java/org/zwobble/mammoth/tests/docx/BodyXmlReaderMakers.java @@ -1,30 +1,21 @@ package org.zwobble.mammoth.tests.docx; -import com.natpryce.makeiteasy.Instantiator; -import com.natpryce.makeiteasy.Property; import org.zwobble.mammoth.internal.docx.*; +import org.zwobble.mammoth.tests.Arguments; import java.io.IOException; import java.io.InputStream; import java.util.Optional; -import static com.natpryce.makeiteasy.Property.newProperty; - public class BodyXmlReaderMakers { - public static final Property STYLES = newProperty(); - public static final Property NUMBERING = newProperty(); - public static final Property RELATIONSHIPS = newProperty(); - public static final Property CONTENT_TYPES = newProperty(); - public static final Property DOCX_FILE = newProperty(); - public static final Property FILE_READER = newProperty(); - - public static final Instantiator bodyReader = - propertyLookup -> new BodyXmlReader( - propertyLookup.valueOf(STYLES, Styles.EMPTY), - propertyLookup.valueOf(NUMBERING, Numbering.EMPTY), - propertyLookup.valueOf(RELATIONSHIPS, Relationships.EMPTY), - propertyLookup.valueOf(CONTENT_TYPES, ContentTypes.DEFAULT), - propertyLookup.valueOf(DOCX_FILE, new DocxFile() { + public static BodyXmlReader bodyReader(Object... args) { + Arguments arguments = new Arguments(args); + return new BodyXmlReader( + arguments.get(Styles.class, Styles.EMPTY), + arguments.get(Numbering.class, Numbering.EMPTY), + arguments.get(Relationships.class, Relationships.EMPTY), + arguments.get(ContentTypes.class, ContentTypes.DEFAULT), + arguments.get(DocxFile.class, new DocxFile() { @Override public Optional tryGetInputStream(String name) throws IOException { throw new UnsupportedOperationException(); @@ -34,10 +25,12 @@ public class BodyXmlReaderMakers { public void close() throws IOException { } }), - propertyLookup.valueOf(FILE_READER, new FileReader() { + arguments.get(FileReader.class, new FileReader() { @Override public InputStream getInputStream(String uri) throws IOException { throw new UnsupportedOperationException(); } - })); + }) + ); + } } -- cgit v1.2.3