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
This commit is contained in:
Jason Height 2006-08-28 00:31:36 +00:00
parent c522b4ff39
commit d636083355
3 changed files with 13 additions and 11 deletions

View File

@ -23,9 +23,9 @@ import org.apache.poi.hssf.util.CellReference;
*/ */
public class GenericFormulaTestCase extends TestCase { 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 CellReference beginCell;
protected int getBeginRow() { protected int getBeginRow() {
@ -36,7 +36,7 @@ public class GenericFormulaTestCase extends TestCase {
return beginCell.getCol(); 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; HSSFCell retval = null;
if (sheet != null) { if (sheet != null) {
row = sheet.getRow(row.getRowNum()+1); row = sheet.getRow(row.getRowNum()+1);
@ -89,15 +89,17 @@ public class GenericFormulaTestCase extends TestCase {
} }
} }
public GenericFormulaTestCase(String beginCell) { public GenericFormulaTestCase(String beginCell) throws Exception {
super("genericTest"); super("genericTest");
if (workbook == null) {
FileInputStream fin = new FileInputStream( FILENAME );
workbook = new HSSFWorkbook( fin );
fin.close();
}
this.beginCell = new CellReference(beginCell); this.beginCell = new CellReference(beginCell);
} }
public void setUp() throws Exception { public void setUp() {
FileInputStream fin = new FileInputStream( FILENAME );
workbook = new HSSFWorkbook( fin );
fin.close();
} }
public void genericTest() throws Exception { public void genericTest() throws Exception {

View File

@ -12,7 +12,7 @@ import junit.framework.TestSuite;
*/ */
public class TestEverything extends 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."); TestSuite suite = new TestSuite("Tests for OperationEval concrete implementation classes.");
suite.addTest(new GenericFormulaTestCase("D23")); suite.addTest(new GenericFormulaTestCase("D23"));
suite.addTest(new GenericFormulaTestCase("D27")); suite.addTest(new GenericFormulaTestCase("D27"));

View File

@ -14,7 +14,7 @@ import junit.framework.TestSuite;
*/ */
public class TestEverything extends 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"); TestSuite suite = new TestSuite("Tests for individual function classes");
String s; String s;
for(int i=80; i<1481;i=i+4) { for(int i=80; i<1481;i=i+4) {