From f62e014f5d6e4606d972486b237633cc22552225 Mon Sep 17 00:00:00 2001 From: Jason Height Date: Mon, 28 Aug 2006 00:31:36 +0000 Subject: [PATCH] Hopefully fixed scratchpad test org.apache.poi.hssf/record/formula/functions/TestEverything.java from running out of memory and killing gump git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@437486 13f79535-47bb-0310-9956-ffa450edef68 --- .../formula/eval/GenericFormulaTestCase.java | 20 ++++++++++--------- .../record/formula/eval/TestEverything.java | 2 +- .../formula/functions/TestEverything.java | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/scratchpad/testcases/org/apache/poi/hssf/record/formula/eval/GenericFormulaTestCase.java b/src/scratchpad/testcases/org/apache/poi/hssf/record/formula/eval/GenericFormulaTestCase.java index 11d947ea87..95a67bc67b 100644 --- a/src/scratchpad/testcases/org/apache/poi/hssf/record/formula/eval/GenericFormulaTestCase.java +++ b/src/scratchpad/testcases/org/apache/poi/hssf/record/formula/eval/GenericFormulaTestCase.java @@ -23,9 +23,9 @@ import org.apache.poi.hssf.util.CellReference; */ public class GenericFormulaTestCase extends TestCase { - protected final String FILENAME = System.getProperty("HSSF.testdata.path")+ "/FormulaEvalTestData.xls"; + protected final static String FILENAME = System.getProperty("HSSF.testdata.path")+ "/FormulaEvalTestData.xls"; - protected HSSFWorkbook workbook = null; + protected static HSSFWorkbook workbook = null; protected CellReference beginCell; protected int getBeginRow() { @@ -36,7 +36,7 @@ public class GenericFormulaTestCase extends TestCase { return beginCell.getCol(); } - protected static final HSSFCell getExpectedValueCell(HSSFSheet sheet, HSSFRow row, HSSFCell cell) { + protected final HSSFCell getExpectedValueCell(HSSFSheet sheet, HSSFRow row, HSSFCell cell) { HSSFCell retval = null; if (sheet != null) { row = sheet.getRow(row.getRowNum()+1); @@ -89,15 +89,17 @@ public class GenericFormulaTestCase extends TestCase { } } - public GenericFormulaTestCase(String beginCell) { - super("genericTest"); + public GenericFormulaTestCase(String beginCell) throws Exception { + super("genericTest"); + if (workbook == null) { + FileInputStream fin = new FileInputStream( FILENAME ); + workbook = new HSSFWorkbook( fin ); + fin.close(); + } this.beginCell = new CellReference(beginCell); } - public void setUp() throws Exception { - FileInputStream fin = new FileInputStream( FILENAME ); - workbook = new HSSFWorkbook( fin ); - fin.close(); + public void setUp() { } public void genericTest() throws Exception { diff --git a/src/scratchpad/testcases/org/apache/poi/hssf/record/formula/eval/TestEverything.java b/src/scratchpad/testcases/org/apache/poi/hssf/record/formula/eval/TestEverything.java index f7db5d48f8..d3c9a314f2 100644 --- a/src/scratchpad/testcases/org/apache/poi/hssf/record/formula/eval/TestEverything.java +++ b/src/scratchpad/testcases/org/apache/poi/hssf/record/formula/eval/TestEverything.java @@ -12,7 +12,7 @@ import junit.framework.TestSuite; */ public class TestEverything extends TestSuite { - public static TestSuite suite() { + public static TestSuite suite() throws Exception { TestSuite suite = new TestSuite("Tests for OperationEval concrete implementation classes."); suite.addTest(new GenericFormulaTestCase("D23")); suite.addTest(new GenericFormulaTestCase("D27")); diff --git a/src/scratchpad/testcases/org/apache/poi/hssf/record/formula/functions/TestEverything.java b/src/scratchpad/testcases/org/apache/poi/hssf/record/formula/functions/TestEverything.java index 85f51af600..7e873d764e 100644 --- a/src/scratchpad/testcases/org/apache/poi/hssf/record/formula/functions/TestEverything.java +++ b/src/scratchpad/testcases/org/apache/poi/hssf/record/formula/functions/TestEverything.java @@ -14,7 +14,7 @@ import junit.framework.TestSuite; */ public class TestEverything extends TestSuite { - public static TestSuite suite() { + public static TestSuite suite() throws Exception { TestSuite suite = new TestSuite("Tests for individual function classes"); String s; for(int i=80; i<1481;i=i+4) { -- 2.39.5