Add helper test to verify that vsdx cannot even be loaded by POIXMLDocument curently.

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1665984 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2015-03-11 19:53:26 +00:00
parent 2879bc1b16
commit 091f06330e

View File

@ -20,9 +20,16 @@ import static org.junit.Assert.assertNotNull;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.List;
import org.apache.poi.POIXMLDocument; import org.apache.poi.POIXMLDocument;
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.opc.PackageAccess;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.junit.Ignore;
import org.junit.Test;
public final class POIXMLDocumentHandler { public final class POIXMLDocumentHandler {
protected void handlePOIXMLDocument(POIXMLDocument doc) throws Exception { protected void handlePOIXMLDocument(POIXMLDocument doc) throws Exception {
@ -43,4 +50,26 @@ public final class POIXMLDocumentHandler {
} }
return false; return false;
} }
// a test-case to test this locally without executing the full TestAllFiles
@Ignore("POIXMLDocument cannot handle this Visio file currently...")
@Test
public void test() throws Exception {
OPCPackage pkg = OPCPackage.open("test-data/diagram/test.vsdx", PackageAccess.READ);
try {
handlePOIXMLDocument(new TestPOIXMLDocument(pkg));
} finally {
pkg.close();
}
}
private final static class TestPOIXMLDocument extends POIXMLDocument {
public TestPOIXMLDocument(OPCPackage pkg) {
super(pkg);
}
public List<PackagePart> getAllEmbedds() throws OpenXML4JException {
return null;
}
}
} }