Integration tests: Add writing out the document

This will cover some more functionality

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1917174 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2024-04-20 07:53:35 +00:00
parent d87ffbc1b0
commit 8c101982e0
2 changed files with 3 additions and 0 deletions

View File

@ -22,6 +22,7 @@ import java.io.FileInputStream;
import java.io.InputStream; import java.io.InputStream;
import java.util.Set; import java.util.Set;
import org.apache.commons.io.output.NullOutputStream;
import org.apache.poi.ooxml.POIXMLException; import org.apache.poi.ooxml.POIXMLException;
import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -41,6 +42,8 @@ public class XWPFFileHandler extends AbstractFileHandler {
try (XWPFDocument doc = new XWPFDocument(stream)) { try (XWPFDocument doc = new XWPFDocument(stream)) {
new POIXMLDocumentHandler().handlePOIXMLDocument(doc); new POIXMLDocumentHandler().handlePOIXMLDocument(doc);
POIXMLDocumentHandler.cursorRecursive(doc.getDocument()); POIXMLDocumentHandler.cursorRecursive(doc.getDocument());
doc.write(NullOutputStream.INSTANCE);
} catch (POIXMLException e) { } catch (POIXMLException e) {
Exception cause = (Exception)e.getCause(); Exception cause = (Exception)e.getCause();
throw cause == null ? e : cause; throw cause == null ? e : cause;

Binary file not shown.