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
This commit is contained in:
Dominik Stadler 2015-12-17 12:39:01 +00:00
parent 9e0601a058
commit ffe36ac2fe

View File

@ -2851,6 +2851,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
wbBack.close(); wbBack.close();
} }
@Test
public void test58731() throws Exception { public void test58731() throws Exception {
Workbook wb = XSSFTestDataSamples.openSampleWorkbook("58731.xlsx"); Workbook wb = XSSFTestDataSamples.openSampleWorkbook("58731.xlsx");
Sheet sheet = wb.createSheet("Java Books"); Sheet sheet = wb.createSheet("Java Books");
@ -2864,11 +2865,11 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
int rowCount = 0; int rowCount = 0;
for (Object[] aBook : bookData) { for (Object[] aBook : bookData) {
Row row = sheet.createRow(++rowCount); Row row = sheet.createRow(rowCount++);
int columnCount = 0; int columnCount = 0;
for (Object field : aBook) { for (Object field : aBook) {
Cell cell = row.createCell(++columnCount); Cell cell = row.createCell(columnCount++);
if (field instanceof String) { if (field instanceof String) {
cell.setCellValue((String) field); cell.setCellValue((String) field);
} else if (field instanceof Integer) { } else if (field instanceof Integer) {
@ -2878,7 +2879,9 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
} }
Workbook wb2 = XSSFTestDataSamples.writeOutAndReadBack(wb); 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()); assertEquals(bookData[0][0], sheet.getRow(0).getCell(0).getStringCellValue());
} }
} }