workbook.close();
- }\r
-\r
- private static String getCellFormula(Sheet sheet, String address) {\r
- CellAddress cellAddress = new CellAddress(address);\r
- Row row = sheet.getRow(cellAddress.getRow());\r
- assertNotNull(row);\r
- Cell cell = row.getCell(cellAddress.getColumn());\r
- assertNotNull(cell);\r
- assertEquals(CellType.FORMULA, cell.getCellTypeEnum());\r
- return cell.getCellFormula();\r
- }\r
+ }
+
+ private static String getCellFormula(Sheet sheet, String address) {
+ CellAddress cellAddress = new CellAddress(address);
+ Row row = sheet.getRow(cellAddress.getRow());
+ assertNotNull(row);
+ Cell cell = row.getCell(cellAddress.getColumn());
+ assertNotNull(cell);
+ assertEquals(CellType.FORMULA, cell.getCellTypeEnum());
+ return cell.getCellFormula();
+ }
// This test is written as expected-to-fail and should be rewritten
// as expected-to-pass when the bug is fixed.
- @Test\r
- public void testSharedFormulas() throws Exception {\r
- XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("TestShiftRowSharedFormula.xlsx");\r
- XSSFSheet sheet = wb.getSheetAt(0);\r
- assertEquals("SUM(C2:C4)", getCellFormula(sheet, "C5"));\r
- assertEquals("SUM(D2:D4)", getCellFormula(sheet, "D5"));\r
- assertEquals("SUM(E2:E4)", getCellFormula(sheet, "E5"));\r
-\r
+ @Test
+ public void testSharedFormulas() throws Exception {
+ XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("TestShiftRowSharedFormula.xlsx");
+ XSSFSheet sheet = wb.getSheetAt(0);
+ assertEquals("SUM(C2:C4)", getCellFormula(sheet, "C5"));
+ assertEquals("SUM(D2:D4)", getCellFormula(sheet, "D5"));
+ assertEquals("SUM(E2:E4)", getCellFormula(sheet, "E5"));
+
sheet.shiftRows(3, sheet.getLastRowNum(), 1);
- // FIXME: remove try, catch, and testPassesNow, skipTest when test passes\r
- try {\r
- assertEquals("SUM(C2:C5)", getCellFormula(sheet, "C6"));\r
- assertEquals("SUM(D2:D5)", getCellFormula(sheet, "D6"));\r
+ // FIXME: remove try, catch, and testPassesNow, skipTest when test passes
+ try {
+ assertEquals("SUM(C2:C5)", getCellFormula(sheet, "C6"));
+ assertEquals("SUM(D2:D5)", getCellFormula(sheet, "D6"));
assertEquals("SUM(E2:E5)", getCellFormula(sheet, "E6"));
testPassesNow(59983);
} catch (AssertionError e) {
skipTest(e);
}
- wb.close();\r
+ wb.close();
}
// bug 60260: shift rows or rename a sheet containing a named range