diff options
author | Dominik Stadler <centic@apache.org> | 2015-02-27 15:01:46 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2015-02-27 15:01:46 +0000 |
commit | 9b84116192bd7afe4454627e8b14689b56bcf63f (patch) | |
tree | c35db0b7cac9507d21be21d36e8185210c56c2f8 /src/scratchpad/testcases/org/apache/poi/hwpf | |
parent | a3e087268a6ff9d5b90d3d334593d56693e400b8 (diff) | |
download | poi-9b84116192bd7afe4454627e8b14689b56bcf63f.tar.gz poi-9b84116192bd7afe4454627e8b14689b56bcf63f.zip |
Move test-case to location where the scratchpad-classes are available
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1662712 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/scratchpad/testcases/org/apache/poi/hwpf')
-rw-r--r-- | src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractor.java | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractor.java b/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractor.java index 82d6f34f42..1a69630a2c 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractor.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractor.java @@ -20,6 +20,7 @@ package org.apache.poi.hwpf.extractor; import junit.framework.TestCase; import org.apache.poi.POIDataSamples; +import org.apache.poi.POITextExtractor; import org.apache.poi.hwpf.HWPFDocument; import org.apache.poi.hwpf.HWPFTestDataSamples; import org.apache.poi.hwpf.OldWordFileFormatException; @@ -377,10 +378,35 @@ public final class TestWordExtractor extends TestCase { for (Entry entry : fs.getRoot()) { if ("WordDocument".equals(entry.getName())) { WordExtractor ex = new WordExtractor(fs); - text = ex.getText(); + try { + text = ex.getText(); + } finally { + ex.close(); + } } } assertNotNull(text); } + + + public void testExtractorFromWord6Extractor() throws Exception { + POIFSFileSystem fs = new POIFSFileSystem(POIDataSamples.getHPSFInstance().openResourceAsStream("TestMickey.doc")); + Word6Extractor wExt = new Word6Extractor(fs); + try { + POITextExtractor ext = wExt.getMetadataTextExtractor(); + try { + // Now overall + String text = ext.getText(); + assertTrue(text.indexOf("TEMPLATE = Normal") > -1); + assertTrue(text.indexOf("SUBJECT = sample subject") > -1); + assertTrue(text.indexOf("MANAGER = sample manager") > -1); + assertTrue(text.indexOf("COMPANY = sample company") > -1); + } finally { + ext.close(); + } + } finally { + wExt.close(); + } + } } |