ooxml o.a.p.ss.formula.TestFormulaParser junit3 -> junit4

git-svn-id: https://svn.apache.org/repos/asf/poi/branches/xssf_structured_references@1747633 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-06-10 04:57:04 +00:00
parent 3de47c1c6f
commit f17c9a9c25
2 changed files with 14 additions and 3 deletions

View File

@ -18,6 +18,11 @@
*/ */
package org.apache.poi.ss.formula; package org.apache.poi.ss.formula;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.apache.poi.hssf.usermodel.HSSFEvaluationWorkbook; import org.apache.poi.hssf.usermodel.HSSFEvaluationWorkbook;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.formula.ptg.AbstractFunctionPtg; import org.apache.poi.ss.formula.ptg.AbstractFunctionPtg;
@ -28,7 +33,7 @@ import org.apache.poi.xssf.XSSFTestDataSamples;
import org.apache.poi.xssf.usermodel.XSSFEvaluationWorkbook; import org.apache.poi.xssf.usermodel.XSSFEvaluationWorkbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import junit.framework.TestCase; import org.junit.Test;
/** /**
* Test {@link FormulaParser}'s handling of row numbers at the edge of the * Test {@link FormulaParser}'s handling of row numbers at the edge of the
@ -36,8 +41,9 @@ import junit.framework.TestCase;
* *
* @author David North * @author David North
*/ */
public class TestFormulaParser extends TestCase { public class TestFormulaParser {
@Test
public void testHSSFFailsForOver65536() { public void testHSSFFailsForOver65536() {
FormulaParsingWorkbook workbook = HSSFEvaluationWorkbook.create(new HSSFWorkbook()); FormulaParsingWorkbook workbook = HSSFEvaluationWorkbook.create(new HSSFWorkbook());
try { try {
@ -49,16 +55,19 @@ public class TestFormulaParser extends TestCase {
} }
} }
@Test
public void testHSSFPassCase() { public void testHSSFPassCase() {
FormulaParsingWorkbook workbook = HSSFEvaluationWorkbook.create(new HSSFWorkbook()); FormulaParsingWorkbook workbook = HSSFEvaluationWorkbook.create(new HSSFWorkbook());
FormulaParser.parse("Sheet1!1:65536", workbook, FormulaType.CELL, 0); FormulaParser.parse("Sheet1!1:65536", workbook, FormulaType.CELL, 0);
} }
@Test
public void testXSSFWorksForOver65536() { public void testXSSFWorksForOver65536() {
FormulaParsingWorkbook workbook = XSSFEvaluationWorkbook.create(new XSSFWorkbook()); FormulaParsingWorkbook workbook = XSSFEvaluationWorkbook.create(new XSSFWorkbook());
FormulaParser.parse("Sheet1!1:65537", workbook, FormulaType.CELL, 0); FormulaParser.parse("Sheet1!1:65537", workbook, FormulaType.CELL, 0);
} }
@Test
public void testXSSFFailCase() { public void testXSSFFailCase() {
FormulaParsingWorkbook workbook = XSSFEvaluationWorkbook.create(new XSSFWorkbook()); FormulaParsingWorkbook workbook = XSSFEvaluationWorkbook.create(new XSSFWorkbook());
try { try {
@ -71,6 +80,7 @@ public class TestFormulaParser extends TestCase {
} }
// copied from org.apache.poi.hssf.model.TestFormulaParser // copied from org.apache.poi.hssf.model.TestFormulaParser
@Test
public void testMacroFunction() throws Exception { public void testMacroFunction() throws Exception {
// testNames.xlsm contains a VB function called 'myFunc' // testNames.xlsm contains a VB function called 'myFunc'
final String testFile = "testNames.xlsm"; final String testFile = "testNames.xlsm";
@ -126,6 +136,7 @@ public class TestFormulaParser extends TestCase {
} }
} }
@Test
public void testParserErrors() throws Exception { public void testParserErrors() throws Exception {
XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("testNames.xlsm"); XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("testNames.xlsm");
try { try {

View File

@ -27,7 +27,7 @@ import org.junit.runners.Suite;
@Suite.SuiteClasses({ @Suite.SuiteClasses({
TestDrawingManager.class, TestDrawingManager.class,
TestDrawingManager2.class, TestDrawingManager2.class,
TestFormulaParser.class, //TestFormulaParser.class, //converted to junit4
TestFormulaParserEval.class, TestFormulaParserEval.class,
TestFormulaParserIf.class, TestFormulaParserIf.class,
TestLinkTable.class, TestLinkTable.class,