]> source.dussan.org Git - poi.git/commitdiff
convert to junit4
authorJaven O'Neal <onealj@apache.org>
Fri, 8 Jul 2016 08:53:34 +0000 (08:53 +0000)
committerJaven O'Neal <onealj@apache.org>
Fri, 8 Jul 2016 08:53:34 +0000 (08:53 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1751870 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/openxml4j/opc/internal/AllOpenXML4JInternalTests.java [deleted file]
src/ooxml/testcases/org/apache/poi/openxml4j/opc/internal/TestContentTypeManager.java

diff --git a/src/ooxml/testcases/org/apache/poi/openxml4j/opc/internal/AllOpenXML4JInternalTests.java b/src/ooxml/testcases/org/apache/poi/openxml4j/opc/internal/AllOpenXML4JInternalTests.java
deleted file mode 100644 (file)
index 81ac746..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* ====================================================================
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-==================================================================== */
-
-package org.apache.poi.openxml4j.opc.internal;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public final class AllOpenXML4JInternalTests {
-
-       public static Test suite() {
-               TestSuite suite = new TestSuite(AllOpenXML4JInternalTests.class.getName());
-               suite.addTestSuite(TestContentTypeManager.class);
-               return suite;
-       }
-}
index 6e6e204401e65c40da70c7373a1ca746aebfcc1b..9acf0d10bc43632bf53229280bfe4a80a2a4f962 100644 (file)
@@ -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.PackageAccess;
 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 TestContentTypeManager extends TestCase {
     /**
      * 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 TestContentTypeManager extends TestCase {
     /**
      * Test the addition then removal of content types in a package.
      */
+    @Ignore
+    @Test
     public void testContentTypeRemovalPackage() {
         // TODO
+        fail("test not written");
     }
 }