aboutsummaryrefslogtreecommitdiffstats
path: root/excelant/src/test
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2021-04-07 21:40:33 +0000
committerAndreas Beeker <kiwiwings@apache.org>2021-04-07 21:40:33 +0000
commitb6aee1ef6d3e92a28ffd4b5c03e677b63b43747f (patch)
treead9c7b312976c4ed113a7f3b5b4757bfe1b3eee6 /excelant/src/test
parent6458acb931a0cc17b2d5ed205a1b3fbbb78b9193 (diff)
downloadpoi-b6aee1ef6d3e92a28ffd4b5c03e677b63b43747f.tar.gz
poi-b6aee1ef6d3e92a28ffd4b5c03e677b63b43747f.zip
65206 - Migrate ant / maven to gradle build
compile / jar / test of mrJars don't include ants build.xml anymore rename directories to match project and maven artifact names refactor artifacts - so each project has one artifact replace static references in hssf/dev tests with junit5 constructs, which had problems in parallel tests increase gradle heap to 4gb because of OOM - maybe less would also work git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1888488 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'excelant/src/test')
-rw-r--r--excelant/src/test/java/org/apache/poi/ss/excelant/CalculateMortgageFunction.java93
-rw-r--r--excelant/src/test/java/org/apache/poi/ss/excelant/ExcelAntUserDefinedFunctionTestHelper.java34
-rw-r--r--excelant/src/test/java/org/apache/poi/ss/excelant/MockExcelAntWorkbookHandler.java39
-rw-r--r--excelant/src/test/java/org/apache/poi/ss/excelant/TestBuildFile.java375
-rw-r--r--excelant/src/test/java/org/apache/poi/ss/excelant/TestExcelAntPrecision.java54
-rw-r--r--excelant/src/test/java/org/apache/poi/ss/excelant/TestExcelAntSet.java69
-rw-r--r--excelant/src/test/java/org/apache/poi/ss/excelant/TestExcelAntSetDoubleCell.java70
-rw-r--r--excelant/src/test/java/org/apache/poi/ss/excelant/TestExcelAntUserDefinedFunction.java57
-rw-r--r--excelant/src/test/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtilTestHelper.java50
-rw-r--r--excelant/src/test/java/org/apache/poi/ss/excelant/util/TestExcelAntEvaluationResult.java76
-rw-r--r--excelant/src/test/java/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtil.java373
-rw-r--r--excelant/src/test/java/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtilFactory.java68
-rw-r--r--excelant/src/test/java9/module-info.classbin410 -> 0 bytes
-rw-r--r--excelant/src/test/java9/module-info.java34
-rw-r--r--excelant/src/test/resources/tests.xml226
15 files changed, 0 insertions, 1618 deletions
diff --git a/excelant/src/test/java/org/apache/poi/ss/excelant/CalculateMortgageFunction.java b/excelant/src/test/java/org/apache/poi/ss/excelant/CalculateMortgageFunction.java
deleted file mode 100644
index 73eb984db7..0000000000
--- a/excelant/src/test/java/org/apache/poi/ss/excelant/CalculateMortgageFunction.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-package org.apache.poi.ss.excelant;
-
-import org.apache.poi.ss.formula.OperationEvaluationContext;
-import org.apache.poi.ss.formula.eval.ErrorEval;
-import org.apache.poi.ss.formula.eval.EvaluationException;
-import org.apache.poi.ss.formula.eval.NumberEval;
-import org.apache.poi.ss.formula.eval.OperandResolver;
-import org.apache.poi.ss.formula.eval.ValueEval;
-import org.apache.poi.ss.formula.functions.FreeRefFunction;
-
-/**
- * A simple user-defined function to calculate principal and interest.
- *
- * Used by {@link org.apache.poi.ss.excelant.util.TestExcelAntWorkbookUtil}.
- *
- * @author Jon Svede ( jon [at] loquatic [dot] com )
- * @author Brian Bush ( brian [dot] bush [at] nrel [dot] gov )
- *
- */
-public class CalculateMortgageFunction implements FreeRefFunction {
-
- @Override
- public ValueEval evaluate( ValueEval[] args, OperationEvaluationContext ec ) {
-
- // verify that we have enough data
- if (args.length != 3) {
- return ErrorEval.VALUE_INVALID;
- }
-
- // declare doubles for values
- double principal, rate, years, result;
- try {
- // extract values as ValueEval
- ValueEval v1 = OperandResolver.getSingleValue( args[0],
- ec.getRowIndex(),
- ec.getColumnIndex() ) ;
- ValueEval v2 = OperandResolver.getSingleValue( args[1],
- ec.getRowIndex(),
- ec.getColumnIndex() ) ;
- ValueEval v3 = OperandResolver.getSingleValue( args[2],
- ec.getRowIndex(),
- ec.getColumnIndex() ) ;
-
- // get data as doubles
- principal = OperandResolver.coerceValueToDouble( v1 ) ;
- rate = OperandResolver.coerceValueToDouble( v2 ) ;
- years = OperandResolver.coerceValueToDouble( v3 ) ;
-
- result = calculateMortgagePayment( principal, rate, years ) ;
- System.out.println( "Result = " + result ) ;
-
- checkValue(result);
-
- } catch (EvaluationException e) {
- return e.getErrorEval();
- }
-
- return new NumberEval( result ) ;
- }
-
- public double calculateMortgagePayment( double p, double r, double y ) {
- double i = r / 12 ;
- double n = y * 12 ;
-
- return p * (( i * Math.pow((1 + i),n ) ) / ( Math.pow((1 + i),n) - 1));
- }
- /**
- * Excel does not support infinities and NaNs, rather, it gives a #NUM! error in these cases
- *
- * @throws EvaluationException (#NUM!) if <tt>result</tt> is <tt>NaN</> or <tt>Infinity</tt>
- */
- private void checkValue(double result) throws EvaluationException {
- if (Double.isNaN(result) || Double.isInfinite(result)) {
- throw new EvaluationException(ErrorEval.NUM_ERROR);
- }
- }
-}
diff --git a/excelant/src/test/java/org/apache/poi/ss/excelant/ExcelAntUserDefinedFunctionTestHelper.java b/excelant/src/test/java/org/apache/poi/ss/excelant/ExcelAntUserDefinedFunctionTestHelper.java
deleted file mode 100644
index 48086fc22d..0000000000
--- a/excelant/src/test/java/org/apache/poi/ss/excelant/ExcelAntUserDefinedFunctionTestHelper.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-package org.apache.poi.ss.excelant;
-
-public class ExcelAntUserDefinedFunctionTestHelper extends
- ExcelAntUserDefinedFunction {
-
- @Override
- protected String getFunctionAlias() {
- // TODO Auto-generated method stub
- return super.getFunctionAlias();
- }
-
- @Override
- protected String getClassName() {
- // TODO Auto-generated method stub
- return super.getClassName();
- }
-
-}
diff --git a/excelant/src/test/java/org/apache/poi/ss/excelant/MockExcelAntWorkbookHandler.java b/excelant/src/test/java/org/apache/poi/ss/excelant/MockExcelAntWorkbookHandler.java
deleted file mode 100644
index d6a3a74b7d..0000000000
--- a/excelant/src/test/java/org/apache/poi/ss/excelant/MockExcelAntWorkbookHandler.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.poi.ss.excelant;
-
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-import org.apache.poi.ss.usermodel.Workbook;
-
-public class MockExcelAntWorkbookHandler implements IExcelAntWorkbookHandler {
- public static boolean executed;
- public static Workbook workbook;
-
-
- @Override
- public void setWorkbook(Workbook workbook) {
- MockExcelAntWorkbookHandler.workbook = workbook;
- }
-
- @Override
- public void execute() {
- executed = true;
- assertNotNull(workbook);
- }
-}
diff --git a/excelant/src/test/java/org/apache/poi/ss/excelant/TestBuildFile.java b/excelant/src/test/java/org/apache/poi/ss/excelant/TestBuildFile.java
deleted file mode 100644
index dbf096ca26..0000000000
--- a/excelant/src/test/java/org/apache/poi/ss/excelant/TestBuildFile.java
+++ /dev/null
@@ -1,375 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.poi.ss.excelant;
-
-import static org.apache.poi.POITestCase.assertContains;
-import static org.apache.poi.POITestCase.assertNotContained;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
-
-import java.io.File;
-import java.io.PrintStream;
-
-import org.apache.poi.POIDataSamples;
-import org.apache.poi.util.NullPrintStream;
-import org.apache.tools.ant.BuildEvent;
-import org.apache.tools.ant.BuildListener;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.ProjectHelper;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-/**
- * JUnit test for the ExcelAnt tasks.
- * Leverages Ant's test framework.
- */
-public class TestBuildFile {
-
- protected Project project;
-
- private StringBuilder logBuffer;
- private StringBuilder fullLogBuffer;
-
-
- @BeforeEach
- void setUp() {
- String filename = TestBuildFile.getDataDir() + "/../excelant/src/test/resources/tests.xml";
- int logLevel = Project.MSG_DEBUG;
-
- logBuffer = new StringBuilder();
- fullLogBuffer = new StringBuilder();
- project = new Project();
- project.init();
- project.setNewProperty("data.dir.name", getDataDir());
- File antFile = new File(System.getProperty("root"), filename);
- project.setUserProperty("ant.file", antFile.getAbsolutePath());
- project.addBuildListener(new AntTestListener(logLevel));
- ProjectHelper.configureProject(project, antFile);
-
- }
-
- /**
- * Automatically calls the target called "tearDown"
- * from the build file tested if it exits.
- * <p>
- * This allows to use Ant tasks directly in the build file
- * to clean up after each test. Note that no "setUp" target
- * is automatically called, since it's trivial to have a
- * test target depend on it.
- */
- @AfterEach
- void tearDown() {
- if (project == null) {
- /*
- * Maybe the BuildFileTest was subclassed and there is
- * no initialized project. So we could avoid getting a
- * NPE.
- * If there is an initialized project getTargets() does
- * not return null as it is initialized by an empty
- * HashSet.
- */
- return;
- }
- final String tearDown = "tearDown";
- if (project.getTargets().containsKey(tearDown)) {
- project.executeTarget(tearDown);
- }
- }
-
- /**
- * run a target, expect for any build exception
- *
- * @param target target to run
- * @param cause information string to reader of report
- */
- void expectBuildException(String target, String cause) {
- expectSpecificBuildException(target, cause, null);
- }
-
- /**
- * Assert that the given substring is in the log messages.
- */
- void assertLogContaining(String substring) {
- assertContains(getLog(), substring);
- }
-
- /**
- * Assert that the given substring is not in the log messages.
- */
- void assertLogNotContaining(String substring) {
- assertNotContained(getLog(), substring);
- }
-
- /**
- * Gets the log the BuildFileTest object.
- * Only valid if configureProject() has been called.
- *
- * @return The log value
- */
- public String getLog() {
- return logBuffer.toString();
- }
-
- /**
- * Executes a target we have set up
- *
- * @param targetName target to run
- */
- void executeTarget(String targetName) {
- PrintStream sysOut = System.out;
- PrintStream sysErr = System.err;
- try {
- sysOut.flush();
- sysErr.flush();
- System.setOut(new NullPrintStream());
- System.setErr(new NullPrintStream());
- logBuffer = new StringBuilder();
- fullLogBuffer = new StringBuilder();
- project.executeTarget(targetName);
- } finally {
- System.setOut(sysOut);
- System.setErr(sysErr);
- }
-
- }
-
- /**
- * Runs a target, wait for a build exception.
- *
- * @param target target to run
- * @param cause information string to reader of report
- * @param msg the message value of the build exception we are waiting
- * for set to null for any build exception to be valid
- */
- void expectSpecificBuildException(String target, String cause, String msg) {
- try {
- executeTarget(target);
- } catch (org.apache.tools.ant.BuildException ex) {
- assertTrue(msg == null || ex.getMessage().equals(msg),
- "Should throw BuildException because '" + cause + "' with message '" + msg + "' (actual message '" + ex.getMessage() + "' instead)"
- );
- return;
- }
- fail("Should throw BuildException because: " + cause);
- }
-
- public static String getDataDir() {
- String dataDirName = System.getProperty(POIDataSamples.TEST_PROPERTY);
- return dataDirName == null ? "test-data" : dataDirName;
- }
-
- /**
- * Our own personal build listener.
- */
- private class AntTestListener implements BuildListener {
- private final int logLevel;
-
- /**
- * Constructs a test listener which will ignore log events
- * above the given level.
- */
- public AntTestListener(int logLevel) {
- this.logLevel = logLevel;
- }
-
- /**
- * Fired before any targets are started.
- */
- @Override
- public void buildStarted(BuildEvent event) {
- }
-
- /**
- * Fired after the last target has finished. This event
- * will still be thrown if an error occurred during the build.
- *
- * @see BuildEvent#getException()
- */
- @Override
- public void buildFinished(BuildEvent event) {
- }
-
- /**
- * Fired when a target is started.
- *
- * @see BuildEvent#getTarget()
- */
- @Override
- public void targetStarted(BuildEvent event) {
- //System.out.println("targetStarted " + event.getTarget().getName());
- }
-
- /**
- * Fired when a target has finished. This event will
- * still be thrown if an error occurred during the build.
- *
- * @see BuildEvent#getException()
- */
- @Override
- public void targetFinished(BuildEvent event) {
- //System.out.println("targetFinished " + event.getTarget().getName());
- }
-
- /**
- * Fired when a task is started.
- *
- * @see BuildEvent#getTask()
- */
- @Override
- public void taskStarted(BuildEvent event) {
- //System.out.println("taskStarted " + event.getTask().getTaskName());
- }
-
- /**
- * Fired when a task has finished. This event will still
- * be throw if an error occurred during the build.
- *
- * @see BuildEvent#getException()
- */
- @Override
- public void taskFinished(BuildEvent event) {
- //System.out.println("taskFinished " + event.getTask().getTaskName());
- }
-
- /**
- * Fired whenever a message is logged.
- *
- * @see BuildEvent#getMessage()
- * @see BuildEvent#getPriority()
- */
- @Override
- public void messageLogged(BuildEvent event) {
- if (event.getPriority() > logLevel) {
- // ignore event
- return;
- }
-
- if (event.getPriority() == Project.MSG_INFO ||
- event.getPriority() == Project.MSG_WARN ||
- event.getPriority() == Project.MSG_ERR) {
- logBuffer.append(event.getMessage());
- }
- fullLogBuffer.append(event.getMessage());
- }
- }
-
- @Test
- void testMissingFilename() {
- expectSpecificBuildException("test-nofile", "required argument not specified",
- "fileName attribute must be set!");
- }
-
- @Test
- void testFileNotFound() {
- expectSpecificBuildException("test-filenotfound", "required argument not specified",
- "Cannot load file invalid.xls. Make sure the path and file permissions are correct.");
- }
-
- @Test
- void testEvaluate() {
- executeTarget("test-evaluate");
- assertLogContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
- assertLogContaining("Succeeded when evaluating 'MortgageCalculator'!$B$4.");
- }
-
- @Test
- void testEvaluateNoDetails() {
- executeTarget("test-evaluate-nodetails");
- assertLogContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
- assertLogNotContaining("Succeeded when evaluating 'MortgageCalculator'!$B$4.");
- }
-
- @Test
- void testPrecision() {
- executeTarget("test-precision");
-
- assertLogContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
- assertLogContaining("Succeeded when evaluating 'MortgageCalculator'!$B$4. " +
- "It evaluated to 2285.5761494145563 when the value of 2285.576149 with precision of 1.0E-4");
- assertLogContaining("Succeeded when evaluating 'MortgageCalculator'!$B$4. " +
- "It evaluated to 2285.5761494145563 when the value of 2285.576149 with precision of 1.0E-5");
- assertLogContaining("Failed to evaluate cell 'MortgageCalculator'!$B$4. " +
- "It evaluated to 2285.5761494145563 when the value of 2285.576149 with precision of 1.0E-10 was expected.");
- assertLogContaining("2/3 tests passed");
- }
-
- @Test
- void testPrecisionFail() {
- expectSpecificBuildException("test-precision-fails", "precision not matched",
- "\tFailed to evaluate cell 'MortgageCalculator'!$B$4. It evaluated to 2285.5761494145563 when the value of 2285.576149 with precision of 1.0E-10 was expected.");
- }
-
- @Test
- void testPassOnError() {
- executeTarget("test-passonerror");
- assertLogContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
- assertLogContaining("Test named failonerror failed because 1 of 0 evaluations failed to evaluate correctly.");
- }
-
- @Test
- void testFailOnError() {
- expectBuildException("test-failonerror", "fail on error");
- assertLogContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
- assertLogNotContaining("failed because 1 of 0 evaluations failed to evaluate correctly. Failed to evaluate cell 'MortageCalculatorFunction'!$D$3");
- }
-
- @Test
- void testFailOnErrorNoDetails() {
- expectBuildException("test-failonerror-nodetails", "fail on error");
- assertLogNotContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
- assertLogNotContaining("failed because 1 of 0 evaluations failed to evaluate correctly. Failed to evaluate cell 'MortageCalculatorFunction'!$D$3");
- }
-
- @Test
- void testUdf() {
- executeTarget("test-udf");
- assertLogContaining("1/1 tests passed");
- }
-
- @Test
- void testSetText() {
- executeTarget("test-settext");
- assertLogContaining("1/1 tests passed");
- }
-
- @Test
- void testAddHandler() {
- executeTarget("test-addhandler");
- assertLogContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
- assertLogContaining("Succeeded when evaluating 'MortgageCalculator'!$B$4.");
-
- assertNotNull(MockExcelAntWorkbookHandler.workbook, "The workbook should have been passed to the handler");
- assertTrue(MockExcelAntWorkbookHandler.executed, "The handler should have been executed");
- }
-
- @Test
- void testAddHandlerWrongClass() {
- executeTarget("test-addhandler-wrongclass");
- assertLogContaining("Using input file: " + TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls");
- assertLogContaining("Succeeded when evaluating 'MortgageCalculator'!$B$4.");
- }
-
- @Test
- void testAddHandlerFails() {
- expectSpecificBuildException("test-addhandler-fails", "NullPointException", null);
- }
-
-}
diff --git a/excelant/src/test/java/org/apache/poi/ss/excelant/TestExcelAntPrecision.java b/excelant/src/test/java/org/apache/poi/ss/excelant/TestExcelAntPrecision.java
deleted file mode 100644
index 2902144fde..0000000000
--- a/excelant/src/test/java/org/apache/poi/ss/excelant/TestExcelAntPrecision.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-package org.apache.poi.ss.excelant;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-class TestExcelAntPrecision {
-
- private ExcelAntPrecision fixture ;
-
- @BeforeEach
- void setUp() {
- fixture = new ExcelAntPrecision() ;
- }
-
- @AfterEach
- void tearDown() {
- fixture = null ;
- }
-
- @Test
- void testVerifyPrecision() {
-
- double value = 1.0E-1 ;
-
- fixture.setValue( value ) ;
-
- double result = fixture.getValue() ;
-
- assertTrue( result > 0 ) ;
-
- assertEquals( value, result, 0.0 ) ;
- }
-
-}
diff --git a/excelant/src/test/java/org/apache/poi/ss/excelant/TestExcelAntSet.java b/excelant/src/test/java/org/apache/poi/ss/excelant/TestExcelAntSet.java
deleted file mode 100644
index 42f6cd256c..0000000000
--- a/excelant/src/test/java/org/apache/poi/ss/excelant/TestExcelAntSet.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-package org.apache.poi.ss.excelant;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtil;
-import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtilFactory;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-class TestExcelAntSet {
-
-
- // This is abstract in nature, so we'll use a
- // concrete instance to test the set methods.
- private ExcelAntSet fixture ;
-
- private static final String mortgageCalculatorFileName =
- TestBuildFile.getDataDir() + "/spreadsheet/mortgage-calculation.xls" ;
-
- @BeforeEach
- void setUp() {
- fixture = new ExcelAntSetDoubleCell() ;
- }
-
- @AfterEach
- void tearDown() {
- fixture = null ;
- }
-
- @Test
- void testSetter() {
- String cell = "simpleCellRef!$F$1" ;
-
- fixture.setCell( cell ) ;
-
- String cellStr = fixture.getCell() ;
-
- assertNotNull( cellStr ) ;
- assertEquals( cell, cellStr ) ;
- }
-
- @Test
- void testSetWorkbookUtil() {
- ExcelAntWorkbookUtil util = ExcelAntWorkbookUtilFactory.getInstance(
- mortgageCalculatorFileName ) ;
-
- assertNotNull( util ) ;
-
- fixture.setWorkbookUtil( util ) ;
- }
-}
diff --git a/excelant/src/test/java/org/apache/poi/ss/excelant/TestExcelAntSetDoubleCell.java b/excelant/src/test/java/org/apache/poi/ss/excelant/TestExcelAntSetDoubleCell.java
deleted file mode 100644
index 45c4f53635..0000000000
--- a/excelant/src/test/java/org/apache/poi/ss/excelant/TestExcelAntSetDoubleCell.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-package org.apache.poi.ss.excelant;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtil;
-import org.apache.poi.ss.excelant.util.ExcelAntWorkbookUtilFactory;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-class TestExcelAntSetDoubleCell {
-
- private ExcelAntSetDoubleCell fixture ;
-
- private ExcelAntWorkbookUtil util ;
-
- private static final String mortgageCalculatorFileName =
- TestBuildFile.getDataDir() + "/spreadsheet/mortgage-calculation.xls" ;
-
- @BeforeEach
- void setUp() {
- fixture = new ExcelAntSetDoubleCell() ;
- util = ExcelAntWorkbookUtilFactory.getInstance(mortgageCalculatorFileName ) ;
- fixture.setWorkbookUtil( util ) ;
- }
-
- @AfterEach
- void tearDown() {
- fixture = null ;
- }
-
- @Test
- void testSetDouble() {
- String cellId = "'Sheet3'!$A$1" ;
- double testValue = 1.1 ;
-
- fixture.setCell( cellId ) ;
- fixture.setValue( testValue ) ;
-
- double value = fixture.getCellValue() ;
-
- assertTrue( value > 0 ) ;
- assertEquals( testValue, value, 0.0 ) ;
-
- fixture.execute() ;
-
- double setValue = util.getCellAsDouble( cellId ) ;
-
- assertEquals( setValue, testValue, 0.0 ) ;
- }
-
-
-}
diff --git a/excelant/src/test/java/org/apache/poi/ss/excelant/TestExcelAntUserDefinedFunction.java b/excelant/src/test/java/org/apache/poi/ss/excelant/TestExcelAntUserDefinedFunction.java
deleted file mode 100644
index 52b580ac6f..0000000000
--- a/excelant/src/test/java/org/apache/poi/ss/excelant/TestExcelAntUserDefinedFunction.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-package org.apache.poi.ss.excelant;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-class TestExcelAntUserDefinedFunction {
-
- private ExcelAntUserDefinedFunctionTestHelper fixture ;
-
- @BeforeEach
- void setUp() {
- fixture = new ExcelAntUserDefinedFunctionTestHelper() ;
- }
-
- @Test
- void testSetClassName() {
- String className = "simple.class.name" ;
-
- fixture.setClassName( className ) ;
- String value = fixture.getClassName() ;
-
- assertNotNull( value ) ;
- assertEquals( className, value ) ;
- }
-
- @Test
- void testSetFunction() {
- String functionAlias = "alias" ;
-
- fixture.setFunctionAlias( functionAlias ) ;
-
- String alias = fixture.getFunctionAlias() ;
-
- assertNotNull( alias ) ;
- assertEquals( functionAlias, alias ) ;
- }
-
-}
diff --git a/excelant/src/test/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtilTestHelper.java b/excelant/src/test/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtilTestHelper.java
deleted file mode 100644
index 16189f1d50..0000000000
--- a/excelant/src/test/java/org/apache/poi/ss/excelant/util/ExcelAntWorkbookUtilTestHelper.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-package org.apache.poi.ss.excelant.util;
-
-import org.apache.poi.ss.formula.udf.UDFFinder;
-import org.apache.poi.ss.usermodel.FormulaEvaluator;
-import org.apache.poi.ss.usermodel.Workbook;
-
-/**
- * A helper class to allow testing of protected methods and constructors.
- *
- * @author jsvede
- *
- */
-public class ExcelAntWorkbookUtilTestHelper extends ExcelAntWorkbookUtil {
-
- public ExcelAntWorkbookUtilTestHelper(String fName) {
- super(fName);
- }
-
- public ExcelAntWorkbookUtilTestHelper(Workbook wb) {
- super(wb);
- }
-
- @Override
- public UDFFinder getFunctions() {
- return super.getFunctions();
- }
-
- @Override
- public FormulaEvaluator getEvaluator(String excelFileName) {
- return super.getEvaluator(excelFileName);
- }
-
-
-}
diff --git a/excelant/src/test/java/org/apache/poi/ss/excelant/util/TestExcelAntEvaluationResult.java b/excelant/src/test/java/org/apache/poi/ss/excelant/util/TestExcelAntEvaluationResult.java
deleted file mode 100644
index dcb044a2eb..0000000000
--- a/excelant/src/test/java/org/apache/poi/ss/excelant/util/TestExcelAntEvaluationResult.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-package org.apache.poi.ss.excelant.util;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-class TestExcelAntEvaluationResult {
- private ExcelAntEvaluationResult fixture;
-
- private boolean completedWithError;
- private boolean passed;
- private double retValue = 1.1;
- private String errMessage = "error message";
- private double delta = 2.2;
- private String cellId = "testCell!$F$1";
-
- @BeforeEach
- void setUp() {
- fixture = new ExcelAntEvaluationResult(completedWithError,
- passed,
- retValue,
- errMessage,
- delta,
- cellId);
- }
-
- @AfterEach
- void tearDown() {
- fixture = null;
- }
-
- @Test
- void testCompletedWithErrorMessage() {
- String errMsg = fixture.getErrorMessage();
- assertNotNull(errMsg);
- assertEquals(errMsg, errMessage);
- }
-
- @Test
- void testPassed() {
- boolean passedValue = fixture.didTestPass();
- assertEquals(passedValue, passed);
- }
-
- @Test
- void testDelta() {
- double deltaValue = fixture.getDelta();
- assertEquals(deltaValue, delta, 0.0);
- }
-
- @Test
- void testCellId() {
- String cellIdValue = fixture.getCellName();
- assertNotNull(cellIdValue);
- assertEquals(cellIdValue, cellId);
- }
-}
diff --git a/excelant/src/test/java/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtil.java b/excelant/src/test/java/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtil.java
deleted file mode 100644
index 4f46084c6a..0000000000
--- a/excelant/src/test/java/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtil.java
+++ /dev/null
@@ -1,373 +0,0 @@
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-package org.apache.poi.ss.excelant.util;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.Date;
-import java.util.List;
-
-import org.apache.poi.ss.excelant.CalculateMortgageFunction;
-import org.apache.poi.ss.excelant.TestBuildFile;
-import org.apache.poi.ss.formula.udf.UDFFinder;
-import org.apache.poi.ss.usermodel.DateUtil;
-import org.apache.poi.ss.usermodel.FormulaEvaluator;
-import org.apache.poi.ss.usermodel.Workbook;
-import org.apache.poi.ss.usermodel.WorkbookFactory;
-import org.apache.tools.ant.BuildException;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Test;
-
-class TestExcelAntWorkbookUtil {
-
- private static final String mortgageCalculatorFileName =
- TestBuildFile.getDataDir() + "/spreadsheet/excelant.xls" ;
-
- private ExcelAntWorkbookUtilTestHelper fixture ;
-
-
- @AfterEach
- void tearDown() {
- fixture = null ;
- }
-
- @Test
- void testStringConstructor() {
- fixture = new ExcelAntWorkbookUtilTestHelper(mortgageCalculatorFileName);
-
- assertNotNull(fixture);
- }
-
- @Test
- void testLoadNotExistingFile() {
- BuildException e = assertThrows(BuildException.class, () -> new ExcelAntWorkbookUtilTestHelper("notexistingFile"));
- assertTrue(e.getMessage().contains("notexistingFile"));
- }
-
- @Test
- void testWorkbookConstructor() throws IOException {
- File workbookFile = new File(mortgageCalculatorFileName);
- FileInputStream fis = new FileInputStream(workbookFile);
- Workbook workbook = WorkbookFactory.create(fis);
-
- fixture = new ExcelAntWorkbookUtilTestHelper(workbook);
-
- assertNotNull(fixture);
- }
-
- @Test
- void testAddFunction() {
- fixture = new ExcelAntWorkbookUtilTestHelper(
- mortgageCalculatorFileName);
-
- assertNotNull(fixture);
-
- fixture.addFunction("h2_ZFactor", new CalculateMortgageFunction());
-
- UDFFinder functions = fixture.getFunctions();
-
- assertNotNull(functions);
- assertNotNull(functions.findFunction("h2_ZFactor"));
- }
-
- @Test
- void testAddFunctionClassName() throws Exception {
- fixture = new ExcelAntWorkbookUtilTestHelper(
- mortgageCalculatorFileName);
-
- assertNotNull(fixture);
-
- fixture.addFunction("h2_ZFactor", CalculateMortgageFunction.class.getName());
-
- UDFFinder functions = fixture.getFunctions();
-
- assertNotNull(functions);
- assertNotNull(functions.findFunction("h2_ZFactor"));
- }
-
- @Test
- void testAddFunctionInvalidClassName() throws Exception {
- fixture = new ExcelAntWorkbookUtilTestHelper(
- mortgageCalculatorFileName);
-
- assertNotNull(fixture);
-
- fixture.addFunction("h2_ZFactor", String.class.getName());
-
- UDFFinder functions = fixture.getFunctions();
-
- assertNotNull(functions);
- assertNull(functions.findFunction("h2_ZFactor"));
- }
-
- @Test
- void testGetWorkbook() {
- fixture = new ExcelAntWorkbookUtilTestHelper(
- mortgageCalculatorFileName);
-
- assertNotNull(fixture);
-
- Workbook workbook = fixture.getWorkbook();
-
- assertNotNull(workbook);
- }
-
- @Test
- void testFileName() {
- fixture = new ExcelAntWorkbookUtilTestHelper(
- mortgageCalculatorFileName);
-
- assertNotNull(fixture);
-
- String fileName = fixture.getFileName();
-
- assertNotNull(fileName);
-
- assertEquals(mortgageCalculatorFileName, fileName);
-
- }
-
- @Test
- void testGetEvaluator() {
- fixture = new ExcelAntWorkbookUtilTestHelper(
- mortgageCalculatorFileName);
-
- FormulaEvaluator evaluator = fixture.getEvaluator(
- mortgageCalculatorFileName);
-
- assertNotNull(evaluator);
- }
-
- @Test
- void testGetEvaluatorWithUDF() {
- fixture = new ExcelAntWorkbookUtilTestHelper(
- mortgageCalculatorFileName);
-
- fixture.addFunction("h2_ZFactor", new CalculateMortgageFunction());
-
- FormulaEvaluator evaluator = fixture.getEvaluator(
- mortgageCalculatorFileName);
-
- assertNotNull(evaluator);
- }
-
- @Test
- void testGetEvaluatorXLSX() {
- fixture = new ExcelAntWorkbookUtilTestHelper(
- TestBuildFile.getDataDir() + "/spreadsheet/sample.xlsx");
-
- FormulaEvaluator evaluator = fixture.getEvaluator(
- TestBuildFile.getDataDir() + "/spreadsheet/sample.xlsx");
-
- assertNotNull(evaluator);
- }
-
- @Test
- void testGetEvaluatorXLSXWithFunction() {
- fixture = new ExcelAntWorkbookUtilTestHelper(
- TestBuildFile.getDataDir() + "/spreadsheet/sample.xlsx");
-
- fixture.addFunction("h2_ZFactor", new CalculateMortgageFunction());
-
- FormulaEvaluator evaluator = fixture.getEvaluator(
- TestBuildFile.getDataDir() + "/spreadsheet/sample.xlsx");
-
- assertNotNull(evaluator);
- }
-
- @Test
- void testEvaluateCell() {
- String cell = "'MortgageCalculator'!B4" ;
- double expectedValue = 790.79 ;
- double precision = 0.1 ;
-
- fixture = new ExcelAntWorkbookUtilTestHelper(
- mortgageCalculatorFileName);
-
- ExcelAntEvaluationResult result = fixture.evaluateCell(cell,
- expectedValue,
- precision);
-
- //System.out.println(result);
- assertTrue( result.toString().contains("evaluationCompletedWithError=false"), "Had:" + result );
- assertTrue( result.toString().contains("returnValue=790.79"), "Had:" + result );
- assertTrue( result.toString().contains("cellName='MortgageCalculator'!B4"), "Had:" + result );
- assertFalse(result.toString().contains("#N/A"));
-
- assertFalse(result.evaluationCompleteWithError());
- assertTrue(result.didTestPass());
- }
-
- @Test
- void testEvaluateCellFailedPrecision() {
- String cell = "'MortgageCalculator'!B4" ;
- double expectedValue = 790.79 ;
- double precision = 0.0000000000001 ;
-
- fixture = new ExcelAntWorkbookUtilTestHelper(
- mortgageCalculatorFileName);
-
- ExcelAntEvaluationResult result = fixture.evaluateCell(cell,
- expectedValue,
- precision);
-
- //System.out.println(result);
- assertTrue( result.toString().contains("evaluationCompletedWithError=false"), "Had:" + result );
- assertTrue( result.toString().contains("returnValue=790.79"), "Had:" + result );
- assertTrue( result.toString().contains("cellName='MortgageCalculator'!B4"), "Had:" + result );
- assertFalse( result.toString().contains("#"), "Should not see an error, but had:" + result );
-
- assertFalse(result.evaluationCompleteWithError());
- assertFalse(result.didTestPass());
- }
-
- @Test
- void testEvaluateCellWithError() {
- String cell = "'ErrorCell'!A1" ;
- double expectedValue = 790.79 ;
- double precision = 0.1 ;
-
- fixture = new ExcelAntWorkbookUtilTestHelper(
- mortgageCalculatorFileName);
-
- ExcelAntEvaluationResult result = fixture.evaluateCell(cell,
- expectedValue,
- precision);
-
- System.out.println(result);
- assertTrue( result.toString().contains("evaluationCompletedWithError=true"), "Had:" + result );
- assertTrue( result.toString().contains("returnValue=0.0"), "Had:" + result );
- assertTrue( result.toString().contains("cellName='ErrorCell'!A1"), "Had:" + result );
- assertTrue( result.toString().contains("#N/A"), "Had:" + result );
-
- assertTrue(result.evaluationCompleteWithError());
- assertFalse(result.didTestPass());
- }
-
- @Test
- void testGetSheets() {
- fixture = new ExcelAntWorkbookUtilTestHelper(
- mortgageCalculatorFileName);
-
- List<String> sheets = fixture.getSheets();
-
- assertNotNull(sheets);
- assertEquals(sheets.size(), 3);
- }
-
- @Test
- void testSetString() {
- String cell = "'MortgageCalculator'!C14" ;
- String cellValue = "testString" ;
-
- fixture = new ExcelAntWorkbookUtilTestHelper(
- mortgageCalculatorFileName);
-
- fixture.setStringValue(cell, cellValue);
-
- String value = fixture.getCellAsString(cell);
-
- assertNotNull(value);
- assertEquals(cellValue, value);
- }
-
- @Test
- void testSetNotExistingSheet() {
- String cell = "'NotexistingSheet'!C14" ;
-
- fixture = new ExcelAntWorkbookUtilTestHelper(mortgageCalculatorFileName);
- BuildException e = assertThrows(BuildException.class, () -> fixture.setStringValue(cell, "some"));
- assertTrue(e.getMessage().contains("NotexistingSheet"));
- }
-
- @Test
- void testSetFormula() {
- String cell = "'MortgageCalculator'!C14" ;
- String cellValue = "SUM(B14:B18)" ;
-
- fixture = new ExcelAntWorkbookUtilTestHelper(
- mortgageCalculatorFileName);
-
- fixture.setFormulaValue(cell, cellValue);
-
- double value = fixture.getCellAsDouble(cell);
-
- assertEquals(0.0, value, 0);
- }
-
- @Test
- void testSetDoubleValue() {
- String cell = "'MortgageCalculator'!C14" ;
- double cellValue = 1.2;
-
- fixture = new ExcelAntWorkbookUtilTestHelper(
- mortgageCalculatorFileName);
-
- fixture.setDoubleValue(cell, cellValue);
-
- double value = fixture.getCellAsDouble(cell);
-
- assertEquals(cellValue, value, 0);
- }
-
- @Test
- void testSetDate() {
- String cell = "'MortgageCalculator'!C14" ;
- Date cellValue = new Date();
-
- fixture = new ExcelAntWorkbookUtilTestHelper(
- mortgageCalculatorFileName);
-
- fixture.setDateValue(cell, cellValue);
-
- double value = fixture.getCellAsDouble(cell);
-
- assertEquals(DateUtil.getExcelDate(cellValue, false), value, 0);
- }
-
- @Test
- void testGetNonexistingString() {
- String cell = "'MortgageCalculator'!C33" ;
-
- fixture = new ExcelAntWorkbookUtilTestHelper(
- mortgageCalculatorFileName);
-
- String value = fixture.getCellAsString(cell);
-
- assertEquals("", value);
- }
-
- @Test
- void testGetNonexistingDouble() {
- String cell = "'MortgageCalculator'!C33" ;
-
- fixture = new ExcelAntWorkbookUtilTestHelper(
- mortgageCalculatorFileName);
-
- double value = fixture.getCellAsDouble(cell);
-
- assertEquals(0.0, value, 0);
- }
-}
diff --git a/excelant/src/test/java/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtilFactory.java b/excelant/src/test/java/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtilFactory.java
deleted file mode 100644
index 26e700fa8b..0000000000
--- a/excelant/src/test/java/org/apache/poi/ss/excelant/util/TestExcelAntWorkbookUtilFactory.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-package org.apache.poi.ss.excelant.util;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-import org.apache.poi.ss.excelant.TestBuildFile;
-import org.junit.jupiter.api.Test;
-
-
-/**
- * Tests for the ExcelAntWorbookUtilFactory.
- */
-class TestExcelAntWorkbookUtilFactory {
-
- private static final String mortgageCalculatorWorkbookFile =
- TestBuildFile.getDataDir() + "/spreadsheet/mortgage-calculation.xls" ;
-
-
- /**
- * Simple test to determine if the factory properly returns an non-null
- * instance of the ExcelAntWorkbookUtil class.
- */
- @Test
- void testGetNewWorkbookUtilInstance() {
- ExcelAntWorkbookUtil util = ExcelAntWorkbookUtilFactory.getInstance(
- mortgageCalculatorWorkbookFile) ;
-
- assertNotNull(util) ;
- }
-
-
- /**
- * Test whether or not the factory will properly return the same reference
- * to an ExcelAnt WorkbookUtil when two different Strings, that point to
- * the same resource, are passed in.
- */
- @Test
- void testVerifyEquivalence() {
- String sameFileName = TestBuildFile.getDataDir() + "/spreadsheet/mortgage-calculation.xls" ;
-
- ExcelAntWorkbookUtil util = ExcelAntWorkbookUtilFactory.getInstance(
- mortgageCalculatorWorkbookFile) ;
-
- ExcelAntWorkbookUtil util2 = ExcelAntWorkbookUtilFactory.getInstance(
- sameFileName) ;
-
- assertNotNull(util) ;
- assertNotNull(util2) ;
-
- assertEquals(util, util2) ;
- }
-}
diff --git a/excelant/src/test/java9/module-info.class b/excelant/src/test/java9/module-info.class
deleted file mode 100644
index 815e1396a6..0000000000
--- a/excelant/src/test/java9/module-info.class
+++ /dev/null
Binary files differ
diff --git a/excelant/src/test/java9/module-info.java b/excelant/src/test/java9/module-info.java
deleted file mode 100644
index a26d9bd04d..0000000000
--- a/excelant/src/test/java9/module-info.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/* ====================================================================
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================== */
-
-module org.apache.poi.excelant {
-
- requires ant;
- requires org.apache.poi.ooxml;
- requires org.apache.poi.scratchpad;
-
- exports org.apache.poi.ss.excelant;
- exports org.apache.poi.ss.excelant.util;
-
- opens org.apache.poi.ss.excelant;
-
- // test specific exports
- requires org.junit.jupiter.api;
- requires org.junit.jupiter.params;
-
- opens org.apache.poi.ss.excelant.util to org.junit.platform.commons;
-} \ No newline at end of file
diff --git a/excelant/src/test/resources/tests.xml b/excelant/src/test/resources/tests.xml
deleted file mode 100644
index 0882195551..0000000000
--- a/excelant/src/test/resources/tests.xml
+++ /dev/null
@@ -1,226 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<project name="excelant-tests" basedir="." xmlns:poi="antlib:org.apache.poi.ss.excelant">
-
- <path id="excelant.classpath">
- <pathelement location="build/classes"/>
- <pathelement location="build/ooxml-classes"/>
- <pathelement location="build/excelant-classes"/>
- <pathelement location="build/excelant-test-classes"/> <!-- test udf is in the test classes -->
- </path>
-
- <typedef resource="org/apache/poi/ss/excelant/antlib.xml"
- classpathref="excelant.classpath"
- uri="antlib:org.apache.poi.ss.excelant"/>
-
- <!-- Should fail because the fileName attribute is missing -->
- <target name="test-nofile">
- <poi:excelant>
-
- </poi:excelant>
- </target>
-
- <!-- Should fail because the specified file is invalid -->
- <target name="test-filenotfound">
- <poi:excelant fileName="invalid.xls">
-
- </poi:excelant>
- </target>
-
- <!-- basic evaluation test -->
- <target name="test-evaluate">
- <poi:excelant fileName="${data.dir.name}/spreadsheet/excelant.xls">
- <poi:test showSuccessDetails="true">
- <poi:setDouble cell="'MortgageCalculator'!$B$1" value="240000"/>
- <poi:setDouble cell="'MortgageCalculator'!$B$2" value ="0.11"/>
- <poi:setDouble cell="'MortgageCalculator'!$B$3" value ="30"/>
- <poi:evaluate showDelta="true" cell="'MortgageCalculator'!$B$4"
- expectedValue="2285.576149" precision="1.0E-4" />
- </poi:test>
- </poi:excelant>
- </target>
-
- <target name="test-evaluate-nodetails">
- <poi:excelant fileName="${data.dir.name}/spreadsheet/excelant.xls">
- <poi:test showSuccessDetails="false">
- <poi:setDouble cell="'MortgageCalculator'!$B$1" value="240000"/>
- <poi:setDouble cell="'MortgageCalculator'!$B$2" value ="0.11"/>
- <poi:setDouble cell="'MortgageCalculator'!$B$3" value ="30"/>
- <poi:evaluate showDelta="true" cell="'MortgageCalculator'!$B$4"
- expectedValue="2285.576149" precision="1.0E-4" />
- </poi:test>
- </poi:excelant>
- </target>
-
- <target name="test-precision">
- <poi:excelant fileName="${data.dir.name}/spreadsheet/excelant.xls">
- <poi:precision value="1.0E-4"/>
-
- <poi:test name="global-precision" showFailureDetail="true" showSuccessDetails="true">
- <poi:setDouble cell="'MortgageCalculator'!$B$1" value="240000"/>
- <poi:setDouble cell="'MortgageCalculator'!$B$2" value ="0.11"/>
- <poi:setDouble cell="'MortgageCalculator'!$B$3" value ="30"/>
- <poi:evaluate showDelta="true" cell="'MortgageCalculator'!$B$4"
- expectedValue="2285.576149"/>
- </poi:test>
-
- <poi:test name="custom-precision" showFailureDetail="true" showSuccessDetails="true">
- <poi:setDouble cell="'MortgageCalculator'!$B$1" value="240000"/>
- <poi:setDouble cell="'MortgageCalculator'!$B$2" value ="0.11"/>
- <poi:setDouble cell="'MortgageCalculator'!$B$3" value ="30"/>
- <poi:evaluate showDelta="true" cell="'MortgageCalculator'!$B$4"
- expectedValue="2285.576149" precision="1.0E-5"/>
- </poi:test>
-
- <poi:test name="tiny-precision" showFailureDetail="true" showSuccessDetails="true">
- <poi:setDouble cell="'MortgageCalculator'!$B$1" value="240000"/>
- <poi:setDouble cell="'MortgageCalculator'!$B$2" value ="0.11"/>
- <poi:setDouble cell="'MortgageCalculator'!$B$3" value ="30"/>
- <poi:evaluate showDelta="true" cell="'MortgageCalculator'!$B$4"
- expectedValue="2285.576149" precision="1.0E-10"/>
- </poi:test>
-
- </poi:excelant>
- </target>
-
- <target name="test-precision-fails">
- <poi:excelant fileName="${data.dir.name}/spreadsheet/excelant.xls">
- <poi:precision value="1.0E-4"/>
-
- <poi:test name="tiny-precision" showFailureDetail="true" showSuccessDetails="true">
- <poi:setDouble cell="'MortgageCalculator'!$B$1" value="240000"/>
- <poi:setDouble cell="'MortgageCalculator'!$B$2" value ="0.11"/>
- <poi:setDouble cell="'MortgageCalculator'!$B$3" value ="30"/>
- <poi:evaluate showDelta="true" cell="'MortgageCalculator'!$B$4"
- expectedValue="2285.576149" precision="1.0E-10" requiredToPass="true"/>
- </poi:test>
-
- </poi:excelant>
- </target>
-
- <!--
- By default ExcelAnt does not terminate execution if an error occurs
- -->
- <target name="test-passonerror">
- <poi:excelant fileName="${data.dir.name}/spreadsheet/excelant.xls">
-
- <poi:test name="failonerror" showFailureDetail="true" showSuccessDetails="true">
- <poi:setDouble cell="'MortageCalculatorFunction'!$D$1" value="1"/>
- <poi:setDouble cell="'MortageCalculatorFunction'!$D$2" value="2"/>
- <poi:setFormula cell="'MortageCalculatorFunction'!$D$3" value ="SUM(D1:D2)"/>
- <poi:evaluate showDelta="true" cell="'MortageCalculatorFunction'!$D$3" expectedValue="2"/>
- </poi:test>
-
- </poi:excelant>
- </target>
-
- <!--
- failOnError="true" forces ExcelAnt tot terminate execution if an error occurs
- -->
- <target name="test-failonerror">
- <poi:excelant fileName="${data.dir.name}/spreadsheet/excelant.xls" failOnError="true">
-
- <poi:test name="failonerror" showFailureDetail="true" showSuccessDetails="true">
- <poi:setDouble cell="'MortageCalculatorFunction'!$D$1" value="1"/>
- <poi:setDouble cell="'MortageCalculatorFunction'!$D$2" value="2"/>
- <poi:setFormula cell="'MortageCalculatorFunction'!$D$3" value ="SUM(D1:D2)"/>
- <poi:evaluate showDelta="true" cell="'MortageCalculatorFunction'!$D$3" expectedValue="2"/>
- </poi:test>
-
- </poi:excelant>
- </target>
-
- <target name="test-failonerror-notdetails">
- <poi:excelant fileName="${data.dir.name}/spreadsheet/excelant.xls" failOnError="true">
-
- <poi:test name="failonerror" showFailureDetail="false" showSuccessDetails="false">
- <poi:setDouble cell="'MortageCalculatorFunction'!$D$1" value="1"/>
- <poi:setDouble cell="'MortageCalculatorFunction'!$D$2" value="2"/>
- <poi:setFormula cell="'MortageCalculatorFunction'!$D$3" value ="SUM(D1:D2)"/>
- <poi:evaluate showDelta="true" cell="'MortageCalculatorFunction'!$D$3" expectedValue="2"/>
- </poi:test>
-
- </poi:excelant>
- </target>
-
- <!-- Evaluation of user-defined functions -->
- <target name="test-udf">
- <poi:excelant fileName="${data.dir.name}/spreadsheet/excelant.xls">
- <poi:udf functionAlias="calculatePayment"
- className="org.apache.poi.ss.excelant.CalculateMortgageFunction"/>
- <poi:test>
- <poi:setDouble cell="'MortageCalculatorFunction'!$B$1" value="240000"/>
- <poi:setDouble cell="'MortageCalculatorFunction'!$B$2" value ="0.11"/>
- <poi:setDouble cell="'MortageCalculatorFunction'!$B$3" value ="30"/>
- <poi:evaluate showDelta="true" cell="'MortageCalculatorFunction'!$B$4"
- expectedValue="2285.576149" precision="1.0E-4" />
- </poi:test>
- </poi:excelant>
- </target>
-
- <!-- basic evaluation test -->
- <target name="test-settext">
- <poi:excelant fileName="${data.dir.name}/spreadsheet/excelant.xls">
- <poi:test showSuccessDetails="true">
- <poi:setString cell="'MortgageCalculator'!$B$1" value="sometext"/>
- <!-- How can we evaluate text? -->
- </poi:test>
- </poi:excelant>
- </target>
-
- <target name="test-addhandler">
- <poi:excelant fileName="${data.dir.name}/spreadsheet/excelant.xls">
- <poi:test showSuccessDetails="true">
- <poi:handler className="org.apache.poi.ss.excelant.MockExcelAntWorkbookHandler"/>
- <poi:setDouble cell="'MortgageCalculator'!$B$1" value="240000"/>
- <poi:setDouble cell="'MortgageCalculator'!$B$2" value ="0.11"/>
- <poi:setDouble cell="'MortgageCalculator'!$B$3" value ="30"/>
- <poi:evaluate showDelta="true" cell="'MortgageCalculator'!$B$4"
- expectedValue="2285.576149" precision="1.0E-4" />
- </poi:test>
- </poi:excelant>
- </target>
-
- <target name="test-addhandler-wrongclass">
- <poi:excelant fileName="${data.dir.name}/spreadsheet/excelant.xls">
- <poi:test showSuccessDetails="true">
- <poi:handler className="java.lang.String"/>
- <poi:setDouble cell="'MortgageCalculator'!$B$1" value="240000"/>
- <poi:setDouble cell="'MortgageCalculator'!$B$2" value ="0.11"/>
- <poi:setDouble cell="'MortgageCalculator'!$B$3" value ="30"/>
- <poi:evaluate showDelta="true" cell="'MortgageCalculator'!$B$4"
- expectedValue="2285.576149" precision="1.0E-4" />
- </poi:test>
- </poi:excelant>
- </target>
-
- <target name="test-addhandler-fails">
- <poi:excelant fileName="${data.dir.name}/spreadsheet/excelant.xls">
- <poi:test showSuccessDetails="true">
- <poi:handler/>
- <poi:setDouble cell="'MortgageCalculator'!$B$1" value="240000"/>
- <poi:setDouble cell="'MortgageCalculator'!$B$2" value ="0.11"/>
- <poi:setDouble cell="'MortgageCalculator'!$B$3" value ="30"/>
- <poi:evaluate showDelta="true" cell="'MortgageCalculator'!$B$4"
- expectedValue="2285.576149" precision="1.0E-4" />
- </poi:test>
- </poi:excelant>
- </target>
-</project>