From 6ff869b74b9ee65a2e985e65af7f63375bc72725 Mon Sep 17 00:00:00 2001 From: Josh Micich Date: Wed, 17 Sep 2008 00:03:07 +0000 Subject: [PATCH] Swapped deprecated code git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@696111 13f79535-47bb-0310-9956-ffa450edef68 --- .../record/formula/functions/TestNper.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) 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 e39777ad2..a2bb0f6ad 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()); }