aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2018-10-17 14:20:02 +0000
committerNick Burch <nick@apache.org>2018-10-17 14:20:02 +0000
commite95fc069293db1fd4988053c6cc078af1287612c (patch)
tree91015c0147233539c8b835bd6c22f1a70695fba6 /src
parent444c8e99667a624162e098bef347a7ab41bb2170 (diff)
downloadpoi-e95fc069293db1fd4988053c6cc078af1287612c.tar.gz
poi-e95fc069293db1fd4988053c6cc078af1287612c.zip
Failing unit test for bug #62831
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1844115 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/ooxml/testcases/org/apache/poi/ss/TestWorkbookFactory.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/ss/TestWorkbookFactory.java b/src/ooxml/testcases/org/apache/poi/ss/TestWorkbookFactory.java
index ade80688d0..e3c631c1da 100644
--- a/src/ooxml/testcases/org/apache/poi/ss/TestWorkbookFactory.java
+++ b/src/ooxml/testcases/org/apache/poi/ss/TestWorkbookFactory.java
@@ -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);
+ }
+ }
}