From: Andreas Beeker Date: Sun, 16 Dec 2018 21:25:57 +0000 (+0000) Subject: fix junit tests X-Git-Tag: REL_4_1_0~183 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=458b9e3aed61c348ca0fe1938c826e8808ba36db;p=poi.git fix junit tests git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1849047 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/scratchpad/testcases/org/apache/poi/hemf/hemfplus/extractor/HemfPlusExtractorTest.java b/src/scratchpad/testcases/org/apache/poi/hemf/hemfplus/extractor/HemfPlusExtractorTest.java index b42bac7d5d..afd255591c 100644 --- a/src/scratchpad/testcases/org/apache/poi/hemf/hemfplus/extractor/HemfPlusExtractorTest.java +++ b/src/scratchpad/testcases/org/apache/poi/hemf/hemfplus/extractor/HemfPlusExtractorTest.java @@ -73,20 +73,16 @@ public class HemfPlusExtractorTest { private EmfCommentDataPlus getCommentRecord(String testFileName, int recordIndex) throws Exception { - EmfCommentDataPlus returnRecord = null; - try (InputStream is = POIDataSamples.getSpreadSheetInstance().openResourceAsStream(testFileName)) { HemfPicture ex = new HemfPicture(is); int i = 0; for (HemfRecord record : ex) { - if (i == recordIndex) { - EmfComment commentRecord = ((EmfComment) record); - returnRecord = (EmfCommentDataPlus) commentRecord.getCommentData(); - break; + if (record instanceof EmfComment && i++ == recordIndex) { + EmfComment commentRecord = (EmfComment)record; + return (EmfCommentDataPlus) commentRecord.getCommentData(); } - i++; } } - return returnRecord; + return null; } } diff --git a/src/scratchpad/testcases/org/apache/poi/hemf/usermodel/HemfPictureTest.java b/src/scratchpad/testcases/org/apache/poi/hemf/usermodel/HemfPictureTest.java index 8ff4742be6..5f630b563e 100644 --- a/src/scratchpad/testcases/org/apache/poi/hemf/usermodel/HemfPictureTest.java +++ b/src/scratchpad/testcases/org/apache/poi/hemf/usermodel/HemfPictureTest.java @@ -207,8 +207,8 @@ public class HemfPictureTest { assertEquals(27864, header.getBytes()); assertEquals(31, header.getRecords()); assertEquals(3, header.getHandles()); - assertEquals(346000, header.getMicroDimension().getWidth()); - assertEquals(194000, header.getMicroDimension().getHeight()); + assertEquals(346000, header.getMicroDimension().getWidth(), 0); + assertEquals(194000, header.getMicroDimension().getHeight(), 0); List records = pic.getRecords();