You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by on...@apache.org on 2016/07/08 08:53:34 UTC
svn commit: r1751870 - in
/poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/internal:
AllOpenXML4JInternalTests.java TestContentTypeManager.java
Author: onealj
Date: Fri Jul 8 08:53:34 2016
New Revision: 1751870
URL: http://svn.apache.org/viewvc?rev=1751870&view=rev
Log:
convert to junit4
Removed:
poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/internal/AllOpenXML4JInternalTests.java
Modified:
poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/internal/TestContentTypeManager.java
Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/internal/TestContentTypeManager.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/internal/TestContentTypeManager.java?rev=1751870&r1=1751869&r2=1751870&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/internal/TestContentTypeManager.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/openxml4j/opc/internal/TestContentTypeManager.java Fri Jul 8 08:53:34 2016
@@ -17,7 +17,9 @@
package org.apache.poi.openxml4j.opc.internal;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
import org.apache.poi.openxml4j.OpenXML4JTestDataSamples;
import org.apache.poi.openxml4j.opc.OPCPackage;
@@ -25,34 +27,39 @@ import org.apache.poi.openxml4j.opc.Pack
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackagePartName;
import org.apache.poi.openxml4j.opc.PackageRelationship;
+import org.apache.poi.openxml4j.opc.PackageRelationshipCollection;
import org.apache.poi.openxml4j.opc.PackageRelationshipTypes;
import org.apache.poi.openxml4j.opc.PackagingURIHelper;
+import org.junit.Ignore;
+import org.junit.Test;
-public final class TestContentTypeManager extends TestCase {
+public final class TestContentTypeManager {
/**
* Test the properties part content parsing.
*/
- public void disabled_testContentType() throws Exception {
+ @Test
+ public void testContentType() throws Exception {
String filepath = OpenXML4JTestDataSamples.getSampleFileName("sample.docx");
- // Retrieves core properties part
- OPCPackage p = OPCPackage.open(filepath, PackageAccess.READ);
- PackageRelationship corePropertiesRelationship = p
- .getRelationshipsByType(
- PackageRelationshipTypes.CORE_PROPERTIES)
- .getRelationship(0);
- PackagePart coreDocument = p.getPart(corePropertiesRelationship);
-
- ContentTypeManager ctm = new ZipContentTypeManager(coreDocument.getInputStream(), p);
-
- // TODO - finish writing this test
- fail();
+ // Retrieves core properties part
+ OPCPackage p = OPCPackage.open(filepath, PackageAccess.READ);
+ PackageRelationshipCollection rels = p.getRelationshipsByType(PackageRelationshipTypes.CORE_PROPERTIES);
+ PackageRelationship corePropertiesRelationship = rels.getRelationship(0);
+ PackagePart coreDocument = p.getPart(corePropertiesRelationship);
+
+ assertEquals("application/vnd.openxmlformats-package.core-properties+xml", coreDocument.getContentType());
+
+ // TODO - finish writing this test
+ assumeTrue("finish writing this test", false);
+
+ ContentTypeManager ctm = new ZipContentTypeManager(coreDocument.getInputStream(), p);
}
/**
* Test the addition of several default and override content types.
*/
+ @Test
public void testContentTypeAddition() throws Exception {
ContentTypeManager ctm = new ZipContentTypeManager(null, null);
@@ -76,6 +83,7 @@ public final class TestContentTypeManage
/**
* Test the addition then removal of content types.
*/
+ @Test
public void testContentTypeRemoval() throws Exception {
ContentTypeManager ctm = new ZipContentTypeManager(null, null);
@@ -104,7 +112,10 @@ public final class TestContentTypeManage
/**
* Test the addition then removal of content types in a package.
*/
+ @Ignore
+ @Test
public void testContentTypeRemovalPackage() {
// TODO
+ fail("test not written");
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org