]> source.dussan.org Git - poi.git/commitdiff
Failing unit test for bug #62831
authorNick Burch <nick@apache.org>
Wed, 17 Oct 2018 14:20:02 +0000 (14:20 +0000)
committerNick Burch <nick@apache.org>
Wed, 17 Oct 2018 14:20:02 +0000 (14:20 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1844115 13f79535-47bb-0310-9956-ffa450edef68

.classpath
src/ooxml/testcases/org/apache/poi/ss/TestWorkbookFactory.java

index fc3394904a581a6c4703536bdc18f03ad6bea219..89d75f475b54c18438ba0aa40d67d33ca7cac539 100644 (file)
@@ -36,7 +36,7 @@
        <classpathentry exported="true" kind="lib" path="lib/commons-collections4-4.2.jar"/>
        <classpathentry kind="lib" path="lib/commons-math3-3.6.1.jar"/>
        <classpathentry kind="lib" path="lib/xmlunit-core-2.5.1.jar"/>
-       <classpathentry kind="lib" path="lib/mockito-core-2.13.0.jar"/>
+       <classpathentry kind="lib" path="lib/mockito-core-2.21.0.jar"/>
        <classpathentry kind="lib" path="lib/byte-buddy-1.7.9.jar"/>
        <classpathentry kind="lib" path="lib/byte-buddy-agent-1.7.9.jar"/>
        <classpathentry kind="lib" path="lib/objenesis-2.6.jar"/>
index ade80688d07946b46cda76b39a89da91c10fe2e3..e3c631c1da4031ac7b0c28e43378e50d8570a199 100644 (file)
@@ -39,6 +39,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.apache.poi.openxml4j.opc.OPCPackage;
 import org.apache.poi.openxml4j.opc.PackageAccess;
 import org.apache.poi.xssf.usermodel.XSSFWorkbookFactory;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public final class TestWorkbookFactory {
@@ -387,4 +388,34 @@ public final class TestWorkbookFactory {
         }
     }
 
+    /**
+     * See Bugzilla bug #62831 - #WorkbookFactory.create(File) needs
+     *  to work for sub-classes of File too, eg JFileChooser
+     */
+    @Test
+    @Ignore
+    public void testFileSubclass() throws Exception {
+        Workbook wb;
+        
+        File normalXLS = HSSFTestDataSamples.getSampleFile(xls);
+        File normalXLSX = HSSFTestDataSamples.getSampleFile(xlsx);
+        File altXLS = new TestFile(normalXLS.getAbsolutePath());
+        File altXLSX = new TestFile(normalXLSX.getAbsolutePath());
+        assertTrue(altXLS.exists());
+        assertTrue(altXLSX.exists());
+        
+        wb = WorkbookFactory.create(altXLS);
+        assertNotNull(wb);
+        assertTrue(wb instanceof HSSFWorkbook);
+        
+        wb = WorkbookFactory.create(altXLSX);
+        assertNotNull(wb);
+        assertTrue(wb instanceof XSSFWorkbook);
+    }
+    
+    private static class TestFile extends File {
+        public TestFile(String file) {
+            super(file);
+        }
+    }
 }