fixed bug in junit which was exposed due to new caching feature of the formula evaluator

git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@693179 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2008-09-08 18:04:34 +00:00
parent 8e18c4ad16
commit d84d5e0b58

View File

@ -36,7 +36,7 @@ public class TestXSSFFormulaEvaluation extends TestCase {
); );
} }
public void testSimpleArithmatic() throws Exception { public void testSimpleArithmatic() {
Workbook wb = new XSSFWorkbook(); Workbook wb = new XSSFWorkbook();
Sheet s = wb.createSheet(); Sheet s = wb.createSheet();
Row r = s.createRow(0); Row r = s.createRow(0);
@ -50,7 +50,6 @@ public class TestXSSFFormulaEvaluation extends TestCase {
assertTrue( Double.isNaN(c2.getNumericCellValue()) ); assertTrue( Double.isNaN(c2.getNumericCellValue()) );
FormulaEvaluator fe = new FormulaEvaluator(s, wb); FormulaEvaluator fe = new FormulaEvaluator(s, wb);
fe.setCurrentRow(r);
fe.evaluateFormulaCell(c1); fe.evaluateFormulaCell(c1);
fe.evaluateFormulaCell(c2); fe.evaluateFormulaCell(c2);
@ -59,7 +58,7 @@ public class TestXSSFFormulaEvaluation extends TestCase {
assertEquals(5.0, c2.getNumericCellValue(), 0.0001); assertEquals(5.0, c2.getNumericCellValue(), 0.0001);
} }
public void testSumCount() throws Exception { public void testSumCount() {
Workbook wb = new XSSFWorkbook(); Workbook wb = new XSSFWorkbook();
Sheet s = wb.createSheet(); Sheet s = wb.createSheet();
Row r = s.createRow(0); Row r = s.createRow(0);
@ -82,14 +81,13 @@ public class TestXSSFFormulaEvaluation extends TestCase {
c3.setCellFormula("COUNT(A1:A1)"); c3.setCellFormula("COUNT(A1:A1)");
assertTrue( Double.isNaN(c3.getNumericCellValue()) ); assertTrue( Double.isNaN(c3.getNumericCellValue()) );
Cell c4 = r.createCell(2); Cell c4 = r.createCell(3);
c4.setCellFormula("COUNTA(A1:E1)"); c4.setCellFormula("COUNTA(A1:E1)");
assertTrue( Double.isNaN(c4.getNumericCellValue()) ); assertTrue( Double.isNaN(c4.getNumericCellValue()) );
// Evaluate and test // Evaluate and test
FormulaEvaluator fe = new FormulaEvaluator(s, wb); FormulaEvaluator fe = new FormulaEvaluator(s, wb);
fe.setCurrentRow(r);
fe.evaluateFormulaCell(c1); fe.evaluateFormulaCell(c1);
fe.evaluateFormulaCell(c2); fe.evaluateFormulaCell(c2);