From: Josh Micich Date: Wed, 17 Sep 2008 00:03:07 +0000 (+0000) Subject: Swapped deprecated code X-Git-Tag: REL_3_2_FINAL~48 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0bee42430646115661b62b3dce2d78592cf05f9b;p=poi.git Swapped deprecated code git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@696111 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/testcases/org/apache/poi/hssf/record/formula/functions/TestNper.java b/src/testcases/org/apache/poi/hssf/record/formula/functions/TestNper.java index e39777ad27..a2bb0f6adb 100644 --- a/src/testcases/org/apache/poi/hssf/record/formula/functions/TestNper.java +++ b/src/testcases/org/apache/poi/hssf/record/formula/functions/TestNper.java @@ -48,29 +48,19 @@ public final class TestNper extends TestCase { } public void testEvaluate_bug_45732() { -// TODO - fix deprecated code etc HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet("Sheet1"); - HSSFCell cell = sheet.createRow(0).createCell((short)0); + HSSFCell cell = sheet.createRow(0).createCell(0); cell.setCellFormula("NPER(12,4500,100000,100000)"); cell.setCellValue(15.0); assertEquals("NPER(12,4500,100000.0,100000.0)", cell.getCellFormula()); -// assertEquals(HSSFCell.CELL_TYPE_NUMERIC, cell.getCachedFormulaResultType()); + assertEquals(HSSFCell.CELL_TYPE_NUMERIC, cell.getCachedFormulaResultType()); assertEquals(15.0, cell.getNumericCellValue(), 0.0); - HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(sheet, wb); - fe.setCurrentRow(sheet.getRow(0)); + HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb); fe.evaluateFormulaCell(cell); -// assertEquals(HSSFCell.CELL_TYPE_ERROR, cell.getCachedFormulaResultType()); - try { - if(cell.getNumericCellValue() == 15.0) { - throw new AssertionFailedError("Identified bug 45732"); - } - } catch (RuntimeException e) { - // expected during successful test - assertEquals("Cannot get a numeric value from a error formula cell", e.getMessage()); - } + assertEquals(HSSFCell.CELL_TYPE_ERROR, cell.getCachedFormulaResultType()); assertEquals(HSSFErrorConstants.ERROR_NUM, cell.getErrorCellValue()); }