mirror of https://github.com/apache/poi.git
fixed unit test failing on jdk-1.6: java code should not rely on the order of HashMap.iterator()
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@734971 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f9a4181480
commit
22bf9b70e4
|
@ -331,33 +331,38 @@ public class TestExtractorFactory extends TestCase {
|
||||||
ext = (POIOLE2TextExtractor)
|
ext = (POIOLE2TextExtractor)
|
||||||
ExtractorFactory.createExtractor(f);
|
ExtractorFactory.createExtractor(f);
|
||||||
embeds = ExtractorFactory.getEmbededDocsTextExtractors(ext);
|
embeds = ExtractorFactory.getEmbededDocsTextExtractors(ext);
|
||||||
|
|
||||||
assertEquals(6, embeds.length);
|
assertEquals(6, embeds.length);
|
||||||
assertTrue(embeds[0] instanceof PowerPointExtractor);
|
int numWord = 0, numXls = 0, numPpt = 0;
|
||||||
assertTrue(embeds[1] instanceof ExcelExtractor);
|
for(int i=0; i<embeds.length; i++) {
|
||||||
assertTrue(embeds[2] instanceof ExcelExtractor);
|
|
||||||
assertTrue(embeds[3] instanceof PowerPointExtractor);
|
|
||||||
assertTrue(embeds[4] instanceof WordExtractor);
|
|
||||||
assertTrue(embeds[5] instanceof WordExtractor);
|
|
||||||
for(int i=0; i<embeds.length; i++) {
|
|
||||||
assertTrue(embeds[i].getText().length() > 20);
|
assertTrue(embeds[i].getText().length() > 20);
|
||||||
}
|
|
||||||
|
if(embeds[i] instanceof PowerPointExtractor) numPpt++;
|
||||||
// Word
|
else if(embeds[i] instanceof ExcelExtractor) numXls++;
|
||||||
|
else if(embeds[i] instanceof WordExtractor) numWord++;
|
||||||
|
}
|
||||||
|
assertEquals(2, numPpt);
|
||||||
|
assertEquals(2, numXls);
|
||||||
|
assertEquals(2, numWord);
|
||||||
|
|
||||||
|
// Word
|
||||||
f = new File(poifs_dir, "word_with_embeded.doc");
|
f = new File(poifs_dir, "word_with_embeded.doc");
|
||||||
ext = (POIOLE2TextExtractor)
|
ext = (POIOLE2TextExtractor)
|
||||||
ExtractorFactory.createExtractor(f);
|
ExtractorFactory.createExtractor(f);
|
||||||
embeds = ExtractorFactory.getEmbededDocsTextExtractors(ext);
|
embeds = ExtractorFactory.getEmbededDocsTextExtractors(ext);
|
||||||
|
|
||||||
|
numWord = 0; numXls = 0; numPpt = 0;
|
||||||
assertEquals(4, embeds.length);
|
assertEquals(4, embeds.length);
|
||||||
assertTrue(embeds[0] instanceof WordExtractor);
|
|
||||||
assertTrue(embeds[1] instanceof ExcelExtractor);
|
|
||||||
assertTrue(embeds[2] instanceof ExcelExtractor);
|
|
||||||
assertTrue(embeds[3] instanceof PowerPointExtractor);
|
|
||||||
for(int i=0; i<embeds.length; i++) {
|
for(int i=0; i<embeds.length; i++) {
|
||||||
assertTrue(embeds[i].getText().length() > 20);
|
assertTrue(embeds[i].getText().length() > 20);
|
||||||
|
if(embeds[i] instanceof PowerPointExtractor) numPpt++;
|
||||||
|
else if(embeds[i] instanceof ExcelExtractor) numXls++;
|
||||||
|
else if(embeds[i] instanceof WordExtractor) numWord++;
|
||||||
}
|
}
|
||||||
|
assertEquals(1, numPpt);
|
||||||
|
assertEquals(2, numXls);
|
||||||
|
assertEquals(1, numWord);
|
||||||
|
|
||||||
// TODO - PowerPoint
|
// TODO - PowerPoint
|
||||||
// TODO - Visio
|
// TODO - Visio
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue