From 4c739915d8fc263a3189f2dbf14da444a698bdd4 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Thu, 17 Dec 2015 12:39:01 +0000 Subject: [PATCH] Fix unit test for bug 58731 to actually run git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1720534 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/xssf/usermodel/TestXSSFBugs.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java index ef57ae0693..527e60efa6 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java @@ -2851,6 +2851,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues { wbBack.close(); } + @Test public void test58731() throws Exception { Workbook wb = XSSFTestDataSamples.openSampleWorkbook("58731.xlsx"); Sheet sheet = wb.createSheet("Java Books"); @@ -2864,11 +2865,11 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues { int rowCount = 0; for (Object[] aBook : bookData) { - Row row = sheet.createRow(++rowCount); + Row row = sheet.createRow(rowCount++); int columnCount = 0; for (Object field : aBook) { - Cell cell = row.createCell(++columnCount); + Cell cell = row.createCell(columnCount++); if (field instanceof String) { cell.setCellValue((String) field); } else if (field instanceof Integer) { @@ -2878,7 +2879,9 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues { } Workbook wb2 = XSSFTestDataSamples.writeOutAndReadBack(wb); - sheet = wb.getSheet("Java Books"); + sheet = wb2.getSheet("Java Books"); + assertNotNull(sheet.getRow(0)); + assertNotNull(sheet.getRow(0).getCell(0)); assertEquals(bookData[0][0], sheet.getRow(0).getCell(0).getStringCellValue()); } }