]> source.dussan.org Git - poi.git/commitdiff
fix junit tests
authorAndreas Beeker <kiwiwings@apache.org>
Sun, 16 Dec 2018 21:25:57 +0000 (21:25 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Sun, 16 Dec 2018 21:25:57 +0000 (21:25 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1849047 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/testcases/org/apache/poi/hemf/hemfplus/extractor/HemfPlusExtractorTest.java
src/scratchpad/testcases/org/apache/poi/hemf/usermodel/HemfPictureTest.java

index b42bac7d5dcc3de4d0d3e0385010ac463c6e4410..afd255591ca8e2ec2e9f531d6c622eb84d661f91 100644 (file)
@@ -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;
     }
 }
index 8ff4742be6dccc0541b22de4c7f8d8e474161a34..5f630b563e2ae6a85d6baaa966e09a415df0177f 100644 (file)
@@ -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<HemfRecord> records = pic.getRecords();