]> source.dussan.org Git - poi.git/commitdiff
bug 45565: add failing unit test for bug 45565
authorJaven O'Neal <onealj@apache.org>
Thu, 22 Sep 2016 03:29:00 +0000 (03:29 +0000)
committerJaven O'Neal <onealj@apache.org>
Thu, 22 Sep 2016 03:29:00 +0000 (03:29 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1761841 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java
test-data/spreadsheet/45565.xls [new file with mode: 0644]

index 9d206f71971034c49b89fe3d16d79f38df3a25ba..92a963f07a99e2669408c40ba3e4d7d4e14cbea5 100644 (file)
@@ -16,6 +16,7 @@
 ==================================================================== */
 package org.apache.poi.extractor;
 
+import static org.apache.poi.POITestCase.assertContains;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -37,6 +38,7 @@ import org.apache.poi.hdgf.extractor.VisioTextExtractor;
 import org.apache.poi.hpbf.extractor.PublisherTextExtractor;
 import org.apache.poi.hslf.extractor.PowerPointExtractor;
 import org.apache.poi.hsmf.extractor.OutlookTextExtactor;
+import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.OldExcelFormatException;
 import org.apache.poi.hssf.extractor.EventBasedExcelExtractor;
 import org.apache.poi.hssf.extractor.ExcelExtractor;
@@ -1019,4 +1021,15 @@ public class TestExtractorFactory {
             // expected here
         }
     }
+    
+    // This bug is currently open. This test will fail with "expected error not thrown" when the bug has been fixed.
+    // When this happens, change this from @Test(expected=...) to @Test
+    @Test(expected=AssertionError.class)
+    public void test45565() throws Exception {
+        POITextExtractor extractor = ExtractorFactory.createExtractor(HSSFTestDataSamples.getSampleFile("45565.xls"));
+        String text = extractor.getText();
+        assertContains(text, "testdoc");
+        assertContains(text, "test phrase");
+        extractor.close();
+    }
 }
diff --git a/test-data/spreadsheet/45565.xls b/test-data/spreadsheet/45565.xls
new file mode 100644 (file)
index 0000000..7facba5
Binary files /dev/null and b/test-data/spreadsheet/45565.xls differ