ANY23-304 implement temporary file reader within test logic
Project: http://git-wip-us.apache.org/repos/asf/any23/repo Commit: http://git-wip-us.apache.org/repos/asf/any23/commit/b39d2201 Tree: http://git-wip-us.apache.org/repos/asf/any23/tree/b39d2201 Diff: http://git-wip-us.apache.org/repos/asf/any23/diff/b39d2201 Branch: refs/heads/master Commit: b39d2201440c5f1297e99365744ac3fd9b4f9d90 Parents: 6d5c39e Author: Lewis John McGibbney <[email protected]> Authored: Thu Jul 27 12:16:29 2017 -0700 Committer: Lewis John McGibbney <[email protected]> Committed: Thu Jul 27 12:16:29 2017 -0700 ---------------------------------------------------------------------- .../java/org/apache/any23/openie/OpenIEExtractorTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/any23/blob/b39d2201/openie/src/test/java/org/apache/any23/openie/OpenIEExtractorTest.java ---------------------------------------------------------------------- diff --git a/openie/src/test/java/org/apache/any23/openie/OpenIEExtractorTest.java b/openie/src/test/java/org/apache/any23/openie/OpenIEExtractorTest.java index 9dfad94..9455311 100644 --- a/openie/src/test/java/org/apache/any23/openie/OpenIEExtractorTest.java +++ b/openie/src/test/java/org/apache/any23/openie/OpenIEExtractorTest.java @@ -16,7 +16,8 @@ */ package org.apache.any23.openie; -import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; import org.apache.any23.extractor.ExtractionContext; @@ -66,8 +67,8 @@ public class OpenIEExtractorTest { public void extract(IRI uri, String filePath) throws IOException, ExtractionException, TripleHandlerException { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - final TripleHandler tHandler = new RDFXMLWriter(baos); + FileOutputStream fos = new FileOutputStream(File.createTempFile("OpenIEExtractorTest", "tmp")); + final TripleHandler tHandler = new RDFXMLWriter(fos); final ExtractionContext extractionContext = new ExtractionContext("rdf-openie", uri); final ExtractionResult result = new ExtractionResultImpl(extractionContext, extractor, tHandler); try { @@ -78,7 +79,7 @@ public class OpenIEExtractorTest { result ); } finally { - logger.debug(baos.toString()); + logger.debug(fos.toString()); tHandler.close(); result.close(); }
