aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/ss/formula
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2020-07-22 22:08:33 +0000
committerAndreas Beeker <kiwiwings@apache.org>2020-07-22 22:08:33 +0000
commitc0f99416047be7c3b7e5413d7a0187a21022a02b (patch)
tree4c0861aa3dc9634684a8048b855426276eebb96b /src/testcases/org/apache/poi/ss/formula
parent800da8b29095a06283380f9adb2c1202a23ee57e (diff)
downloadpoi-c0f99416047be7c3b7e5413d7a0187a21022a02b.tar.gz
poi-c0f99416047be7c3b7e5413d7a0187a21022a02b.zip
#64411 - Provide JigSaw modules
- use classpath-build for Java 8, otherwise use modulepath - save module-info classes to source, when using Java 9+ environment - rename example packages - otherwise package clashes occured in the tests - move agile encryption from ooxml to main. remove EncryptionInfo XmlBeans and schema and use custom xml marshalling - move ooxml test classes which reside in the same package as their tested main class - rename base test classes to "BaseTest..." - temporarily I've used a light version of the main test classes to test scratchpad / ooxml - build.xml - fixed the Rhino javascript errors of the dependency-macros - DrawTextParagraph - fixed StringIndexOutOfBounds when logging set to debug level - use JigSaw provider interface (= Java ServiceLoader), i.e. it wasn't possible (without openening everything), to access ooxml factory classes from main factory stub git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1880164 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/ss/formula')
-rw-r--r--src/testcases/org/apache/poi/ss/formula/AllSSFormulaTests.java4
-rw-r--r--src/testcases/org/apache/poi/ss/formula/BaseTestMissingWorkbook.java (renamed from src/testcases/org/apache/poi/ss/formula/TestMissingWorkbook.java)48
-rw-r--r--src/testcases/org/apache/poi/ss/formula/eval/forked/BaseTestForkedEvaluator.java (renamed from src/testcases/org/apache/poi/ss/formula/eval/forked/TestForkedEvaluator.java)10
-rw-r--r--src/testcases/org/apache/poi/ss/formula/functions/BaseTestNumeric.java (renamed from src/testcases/org/apache/poi/ss/formula/functions/AbstractNumericTestCase.java)2
-rw-r--r--src/testcases/org/apache/poi/ss/formula/functions/TestFinanceLib.java2
-rw-r--r--src/testcases/org/apache/poi/ss/formula/functions/TestMathX.java2
-rw-r--r--src/testcases/org/apache/poi/ss/formula/functions/TestStatsLib.java2
-rw-r--r--src/testcases/org/apache/poi/ss/formula/functions/TestTrunc.java2
-rw-r--r--src/testcases/org/apache/poi/ss/formula/ptg/BaseTestPtg.java (renamed from src/testcases/org/apache/poi/ss/formula/ptg/AbstractPtgTestCase.java)2
-rw-r--r--src/testcases/org/apache/poi/ss/formula/ptg/TestArea3DPtg.java2
-rw-r--r--src/testcases/org/apache/poi/ss/formula/ptg/TestAreaErrPtg.java2
-rw-r--r--src/testcases/org/apache/poi/ss/formula/ptg/TestAttrPtg.java2
-rw-r--r--src/testcases/org/apache/poi/ss/formula/ptg/TestErrPtg.java2
-rw-r--r--src/testcases/org/apache/poi/ss/formula/ptg/TestIntersectionPtg.java2
-rw-r--r--src/testcases/org/apache/poi/ss/formula/ptg/TestPercentPtg.java2
-rw-r--r--src/testcases/org/apache/poi/ss/formula/ptg/TestRangePtg.java2
-rw-r--r--src/testcases/org/apache/poi/ss/formula/ptg/TestRef3DPtg.java2
-rw-r--r--src/testcases/org/apache/poi/ss/formula/ptg/TestUnionPtg.java2
18 files changed, 46 insertions, 46 deletions
diff --git a/src/testcases/org/apache/poi/ss/formula/AllSSFormulaTests.java b/src/testcases/org/apache/poi/ss/formula/AllSSFormulaTests.java
index 59631017d2..14427df5d4 100644
--- a/src/testcases/org/apache/poi/ss/formula/AllSSFormulaTests.java
+++ b/src/testcases/org/apache/poi/ss/formula/AllSSFormulaTests.java
@@ -17,7 +17,7 @@
package org.apache.poi.ss.formula;
-import org.apache.poi.ss.formula.eval.forked.TestForkedEvaluator;
+import org.apache.poi.ss.formula.eval.forked.BaseTestForkedEvaluator;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@@ -29,7 +29,7 @@ import org.junit.runners.Suite;
TestCellCacheEntry.class,
TestEvaluationCache.class,
TestWorkbookEvaluator.class,
- TestForkedEvaluator.class
+ BaseTestForkedEvaluator.class
})
public class AllSSFormulaTests {
}
diff --git a/src/testcases/org/apache/poi/ss/formula/TestMissingWorkbook.java b/src/testcases/org/apache/poi/ss/formula/BaseTestMissingWorkbook.java
index 1093e541a9..9cb755cf27 100644
--- a/src/testcases/org/apache/poi/ss/formula/TestMissingWorkbook.java
+++ b/src/testcases/org/apache/poi/ss/formula/BaseTestMissingWorkbook.java
@@ -19,6 +19,15 @@
package org.apache.poi.ss.formula;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.HashMap;
+import java.util.Map;
+
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
@@ -30,39 +39,30 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-public class TestMissingWorkbook {
+public class BaseTestMissingWorkbook {
protected Workbook mainWorkbook;
protected Workbook sourceWorkbook;
-
+
protected final String MAIN_WORKBOOK_FILENAME;
protected final String SOURCE_DUMMY_WORKBOOK_FILENAME;
protected final String SOURCE_WORKBOOK_FILENAME;
-
- public TestMissingWorkbook() {
+
+ public BaseTestMissingWorkbook() {
this("52575_main.xls", "source_dummy.xls", "52575_source.xls");
}
- protected TestMissingWorkbook(String MAIN_WORKBOOK_FILENAME,
- String SOURCE_DUMMY_WORKBOOK_FILENAME, String SOURCE_WORKBOOK_FILENAME) {
- this.MAIN_WORKBOOK_FILENAME = MAIN_WORKBOOK_FILENAME;
+ protected BaseTestMissingWorkbook(String MAIN_WORKBOOK_FILENAME,
+ String SOURCE_DUMMY_WORKBOOK_FILENAME, String SOURCE_WORKBOOK_FILENAME) {
+ this.MAIN_WORKBOOK_FILENAME = MAIN_WORKBOOK_FILENAME;
this.SOURCE_DUMMY_WORKBOOK_FILENAME = SOURCE_DUMMY_WORKBOOK_FILENAME;
this.SOURCE_WORKBOOK_FILENAME = SOURCE_WORKBOOK_FILENAME;
}
-
+
@Before
public void setUp() throws Exception {
mainWorkbook = HSSFTestDataSamples.openSampleWorkbook(MAIN_WORKBOOK_FILENAME);
sourceWorkbook = HSSFTestDataSamples.openSampleWorkbook(SOURCE_WORKBOOK_FILENAME);
-
+
assertNotNull(mainWorkbook);
assertNotNull(sourceWorkbook);
}
@@ -81,11 +81,11 @@ public class TestMissingWorkbook {
@Test
public void testMissingWorkbookMissing() {
FormulaEvaluator evaluator = mainWorkbook.getCreationHelper().createFormulaEvaluator();
-
+
Sheet lSheet = mainWorkbook.getSheetAt(0);
Row lARow = lSheet.getRow(0);
Cell lA1Cell = lARow.getCell(0);
-
+
assertEquals(CellType.FORMULA, lA1Cell.getCellType());
try {
evaluator.evaluateFormulaCell(lA1Cell);
@@ -101,7 +101,7 @@ public class TestMissingWorkbook {
Cell lA1Cell = lSheet.getRow(0).getCell(0);
Cell lB1Cell = lSheet.getRow(1).getCell(0);
Cell lC1Cell = lSheet.getRow(2).getCell(0);
-
+
assertEquals(CellType.FORMULA, lA1Cell.getCellType());
assertEquals(CellType.FORMULA, lB1Cell.getCellType());
assertEquals(CellType.FORMULA, lC1Cell.getCellType());
@@ -110,7 +110,7 @@ public class TestMissingWorkbook {
assertEquals(10.0d, lA1Cell.getNumericCellValue(), 0.00001d);
assertEquals("POI rocks!", lB1Cell.getStringCellValue());
assertTrue(lC1Cell.getBooleanCellValue());
-
+
// Evaluate
FormulaEvaluator evaluator = mainWorkbook.getCreationHelper().createFormulaEvaluator();
evaluator.setIgnoreMissingWorkbooks(true);
@@ -130,7 +130,7 @@ public class TestMissingWorkbook {
Cell lA1Cell = lSheet.getRow(0).getCell(0);
Cell lB1Cell = lSheet.getRow(1).getCell(0);
Cell lC1Cell = lSheet.getRow(2).getCell(0);
-
+
assertEquals(CellType.FORMULA, lA1Cell.getCellType());
assertEquals(CellType.FORMULA, lB1Cell.getCellType());
assertEquals(CellType.FORMULA, lC1Cell.getCellType());
@@ -141,7 +141,7 @@ public class TestMissingWorkbook {
workbooks.put(MAIN_WORKBOOK_FILENAME, lMainWorkbookEvaluator);
workbooks.put(SOURCE_DUMMY_WORKBOOK_FILENAME, lSourceEvaluator);
lMainWorkbookEvaluator.setupReferencedWorkbooks(workbooks);
-
+
assertEquals(CellType.NUMERIC, lMainWorkbookEvaluator.evaluateFormulaCell(lA1Cell));
assertEquals(CellType.STRING, lMainWorkbookEvaluator.evaluateFormulaCell(lB1Cell));
assertEquals(CellType.BOOLEAN, lMainWorkbookEvaluator.evaluateFormulaCell(lC1Cell));
diff --git a/src/testcases/org/apache/poi/ss/formula/eval/forked/TestForkedEvaluator.java b/src/testcases/org/apache/poi/ss/formula/eval/forked/BaseTestForkedEvaluator.java
index e27499ce39..578452fe50 100644
--- a/src/testcases/org/apache/poi/ss/formula/eval/forked/TestForkedEvaluator.java
+++ b/src/testcases/org/apache/poi/ss/formula/eval/forked/BaseTestForkedEvaluator.java
@@ -32,15 +32,15 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-public class TestForkedEvaluator {
-
+public class BaseTestForkedEvaluator {
+
@Rule
public ExpectedException expectedEx = ExpectedException.none();
-
+
protected Workbook newWorkbook() {
return new HSSFWorkbook();
}
-
+
/**
* set up a calculation workbook with input cells nicely segregated on a
* sheet called "Inputs"
@@ -92,7 +92,7 @@ public class TestForkedEvaluator {
eval1 = (NumberEval) fe1.evaluate("Calculations", 0, 0);
assertNotNull(eval1);
assertEquals(13.9, eval1.getNumberValue(), 0.0);
-
+
wb.close();
}
diff --git a/src/testcases/org/apache/poi/ss/formula/functions/AbstractNumericTestCase.java b/src/testcases/org/apache/poi/ss/formula/functions/BaseTestNumeric.java
index 7d0fd5e7ad..ea1055cf7a 100644
--- a/src/testcases/org/apache/poi/ss/formula/functions/AbstractNumericTestCase.java
+++ b/src/testcases/org/apache/poi/ss/formula/functions/BaseTestNumeric.java
@@ -26,7 +26,7 @@ import static org.junit.Assert.assertTrue;
* @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
*
*/
-public abstract class AbstractNumericTestCase {
+public abstract class BaseTestNumeric {
public static final double POS_ZERO = 1E-4;
public static final double DIFF_TOLERANCE_FACTOR = 1E-8;
diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestFinanceLib.java b/src/testcases/org/apache/poi/ss/formula/functions/TestFinanceLib.java
index 212c8acc62..2e08083ca2 100644
--- a/src/testcases/org/apache/poi/ss/formula/functions/TestFinanceLib.java
+++ b/src/testcases/org/apache/poi/ss/formula/functions/TestFinanceLib.java
@@ -27,7 +27,7 @@ import org.junit.Test;
* @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
*
*/
-public class TestFinanceLib extends AbstractNumericTestCase {
+public class TestFinanceLib extends BaseTestNumeric {
@Test
public void testFv() {
diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestMathX.java b/src/testcases/org/apache/poi/ss/formula/functions/TestMathX.java
index 43a7d48cc9..22506bd00e 100644
--- a/src/testcases/org/apache/poi/ss/formula/functions/TestMathX.java
+++ b/src/testcases/org/apache/poi/ss/formula/functions/TestMathX.java
@@ -30,7 +30,7 @@ import org.junit.Test;
* @author Amol S. Deshmukh &lt; amolweb at ya hoo dot com &gt;
*
*/
-public class TestMathX extends AbstractNumericTestCase {
+public class TestMathX extends BaseTestNumeric {
@Test
public void testAcosh() {
diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestStatsLib.java b/src/testcases/org/apache/poi/ss/formula/functions/TestStatsLib.java
index b489cdcb4b..bb8b8e62bb 100644
--- a/src/testcases/org/apache/poi/ss/formula/functions/TestStatsLib.java
+++ b/src/testcases/org/apache/poi/ss/formula/functions/TestStatsLib.java
@@ -29,7 +29,7 @@ import org.junit.Ignore;
import org.junit.Test;
-public class TestStatsLib extends AbstractNumericTestCase {
+public class TestStatsLib extends BaseTestNumeric {
@Test
public void testDevsq() {
diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestTrunc.java b/src/testcases/org/apache/poi/ss/formula/functions/TestTrunc.java
index b11fd45ad2..a501435616 100644
--- a/src/testcases/org/apache/poi/ss/formula/functions/TestTrunc.java
+++ b/src/testcases/org/apache/poi/ss/formula/functions/TestTrunc.java
@@ -29,7 +29,7 @@ import org.junit.Test;
*
* @author Stephen Wolke (smwolke at geistig.com)
*/
-public final class TestTrunc extends AbstractNumericTestCase {
+public final class TestTrunc extends BaseTestNumeric {
private static final NumericFunction F = null;
@Test
diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/AbstractPtgTestCase.java b/src/testcases/org/apache/poi/ss/formula/ptg/BaseTestPtg.java
index d03a4e269a..8e566bf929 100644
--- a/src/testcases/org/apache/poi/ss/formula/ptg/AbstractPtgTestCase.java
+++ b/src/testcases/org/apache/poi/ss/formula/ptg/BaseTestPtg.java
@@ -24,7 +24,7 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
* Convenient abstract class to reduce the amount of boilerplate code needed
* in ptg-related unit tests.
*/
-public abstract class AbstractPtgTestCase {
+public abstract class BaseTestPtg {
/**
* Loads a workbook from the given filename in the test data dir.
diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestArea3DPtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestArea3DPtg.java
index c06f7f7b35..481d7c5051 100644
--- a/src/testcases/org/apache/poi/ss/formula/ptg/TestArea3DPtg.java
+++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestArea3DPtg.java
@@ -28,7 +28,7 @@ import org.junit.Test;
/**
* Tests for Area3DPtg
*/
-public final class TestArea3DPtg extends AbstractPtgTestCase {
+public final class TestArea3DPtg extends BaseTestPtg {
/**
* confirms that sheet names get properly escaped
diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestAreaErrPtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestAreaErrPtg.java
index 028ed03d3f..3d04da1db5 100644
--- a/src/testcases/org/apache/poi/ss/formula/ptg/TestAreaErrPtg.java
+++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestAreaErrPtg.java
@@ -27,7 +27,7 @@ import org.junit.Test;
/**
* Tests for {@link AreaErrPtg}.
*/
-public final class TestAreaErrPtg extends AbstractPtgTestCase {
+public final class TestAreaErrPtg extends BaseTestPtg {
/**
* Tests reading a file containing this ptg.
*/
diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestAttrPtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestAttrPtg.java
index b7b058007a..d957a956aa 100644
--- a/src/testcases/org/apache/poi/ss/formula/ptg/TestAttrPtg.java
+++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestAttrPtg.java
@@ -27,7 +27,7 @@ import org.junit.Test;
/**
* Tests for {@link AttrPtg}.
*/
-public final class TestAttrPtg extends AbstractPtgTestCase {
+public final class TestAttrPtg extends BaseTestPtg {
/**
* Fix for bug visible around svn r706772.
diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestErrPtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestErrPtg.java
index 5f9af47846..0ff6ad78b6 100644
--- a/src/testcases/org/apache/poi/ss/formula/ptg/TestErrPtg.java
+++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestErrPtg.java
@@ -28,7 +28,7 @@ import org.junit.Test;
/**
* Tests for {@link ErrPtg}.
*/
-public final class TestErrPtg extends AbstractPtgTestCase {
+public final class TestErrPtg extends BaseTestPtg {
/**
* Tests reading a file containing this ptg.
*/
diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestIntersectionPtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestIntersectionPtg.java
index c13bf638a9..729920cb8a 100644
--- a/src/testcases/org/apache/poi/ss/formula/ptg/TestIntersectionPtg.java
+++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestIntersectionPtg.java
@@ -28,7 +28,7 @@ import org.junit.Test;
/**
* Tests for {@link IntersectionPtg}.
*/
-public final class TestIntersectionPtg extends AbstractPtgTestCase {
+public final class TestIntersectionPtg extends BaseTestPtg {
/**
* Tests reading a file containing this ptg.
*/
diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestPercentPtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestPercentPtg.java
index 84ede5baa6..4b69d0743b 100644
--- a/src/testcases/org/apache/poi/ss/formula/ptg/TestPercentPtg.java
+++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestPercentPtg.java
@@ -28,7 +28,7 @@ import org.junit.Test;
/**
* Tests for {@link PercentPtg}.
*/
-public final class TestPercentPtg extends AbstractPtgTestCase {
+public final class TestPercentPtg extends BaseTestPtg {
/**
* Tests reading a file containing this ptg.
*/
diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestRangePtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestRangePtg.java
index 55438777fa..5389538ab2 100644
--- a/src/testcases/org/apache/poi/ss/formula/ptg/TestRangePtg.java
+++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestRangePtg.java
@@ -28,7 +28,7 @@ import org.junit.Test;
/**
* Tests for {@link RangePtg}.
*/
-public final class TestRangePtg extends AbstractPtgTestCase {
+public final class TestRangePtg extends BaseTestPtg {
/**
* Tests reading a file containing this ptg.
*/
diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestRef3DPtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestRef3DPtg.java
index 2bea126dab..04de2cb6e3 100644
--- a/src/testcases/org/apache/poi/ss/formula/ptg/TestRef3DPtg.java
+++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestRef3DPtg.java
@@ -28,7 +28,7 @@ import org.junit.Test;
/**
* Tests for Ref3DPtg
*/
-public final class TestRef3DPtg extends AbstractPtgTestCase {
+public final class TestRef3DPtg extends BaseTestPtg {
@Test
public void testToFormulaString() throws IOException {
diff --git a/src/testcases/org/apache/poi/ss/formula/ptg/TestUnionPtg.java b/src/testcases/org/apache/poi/ss/formula/ptg/TestUnionPtg.java
index 7d6fc3151c..446700f78d 100644
--- a/src/testcases/org/apache/poi/ss/formula/ptg/TestUnionPtg.java
+++ b/src/testcases/org/apache/poi/ss/formula/ptg/TestUnionPtg.java
@@ -28,7 +28,7 @@ import org.junit.Test;
/**
* Tests for {@link UnionPtg}.
*/
-public final class TestUnionPtg extends AbstractPtgTestCase {
+public final class TestUnionPtg extends BaseTestPtg {
/**
* Tests reading a file containing this ptg.
*/