fix junit tests

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1849047 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2018-12-16 21:25:57 +00:00
parent 150a00654e
commit 458b9e3aed
2 changed files with 6 additions and 10 deletions

View File

@ -73,20 +73,16 @@ public class HemfPlusExtractorTest {
private EmfCommentDataPlus getCommentRecord(String testFileName, int recordIndex) throws Exception { private EmfCommentDataPlus getCommentRecord(String testFileName, int recordIndex) throws Exception {
EmfCommentDataPlus returnRecord = null;
try (InputStream is = POIDataSamples.getSpreadSheetInstance().openResourceAsStream(testFileName)) { try (InputStream is = POIDataSamples.getSpreadSheetInstance().openResourceAsStream(testFileName)) {
HemfPicture ex = new HemfPicture(is); HemfPicture ex = new HemfPicture(is);
int i = 0; int i = 0;
for (HemfRecord record : ex) { for (HemfRecord record : ex) {
if (i == recordIndex) { if (record instanceof EmfComment && i++ == recordIndex) {
EmfComment commentRecord = ((EmfComment) record); EmfComment commentRecord = (EmfComment)record;
returnRecord = (EmfCommentDataPlus) commentRecord.getCommentData(); return (EmfCommentDataPlus) commentRecord.getCommentData();
break;
} }
i++;
} }
} }
return returnRecord; return null;
} }
} }

View File

@ -207,8 +207,8 @@ public class HemfPictureTest {
assertEquals(27864, header.getBytes()); assertEquals(27864, header.getBytes());
assertEquals(31, header.getRecords()); assertEquals(31, header.getRecords());
assertEquals(3, header.getHandles()); assertEquals(3, header.getHandles());
assertEquals(346000, header.getMicroDimension().getWidth()); assertEquals(346000, header.getMicroDimension().getWidth(), 0);
assertEquals(194000, header.getMicroDimension().getHeight()); assertEquals(194000, header.getMicroDimension().getHeight(), 0);
List<HemfRecord> records = pic.getRecords(); List<HemfRecord> records = pic.getRecords();