aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJaven O'Neal <onealj@apache.org>2016-07-07 23:00:07 +0000
committerJaven O'Neal <onealj@apache.org>2016-07-07 23:00:07 +0000
commit417868e70cef5bc65abaf8887b5bc4f3653c4e92 (patch)
tree24a81fa6941bfaa0792283e727af0089744312fc /src
parentda9e9bad185b877a220e6339e5511208f8233aa0 (diff)
downloadpoi-417868e70cef5bc65abaf8887b5bc4f3653c4e92.tar.gz
poi-417868e70cef5bc65abaf8887b5bc4f3653c4e92.zip
add crude line-coverage tests for setDebugEvaluationOutputForNextEval and setIgnoreMissingWorkbooks
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1751841 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java21
-rw-r--r--src/testcases/org/apache/poi/ss/formula/TestWorkbookEvaluator.java28
2 files changed, 39 insertions, 10 deletions
diff --git a/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java b/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java
index 43375eff80..3fad35edc0 100644
--- a/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java
+++ b/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java
@@ -114,6 +114,16 @@ public final class WorkbookEvaluator {
private boolean _ignoreMissingWorkbooks = false;
/**
+ * whether print detailed messages about the next formula evaluation
+ */
+ private boolean dbgEvaluationOutputForNextEval = false;
+
+ // special logger for formula evaluation output (because of possibly very large output)
+ private final POILogger EVAL_LOG = POILogFactory.getLogger("POI.FormulaEval");
+ // current indent level for evalution; negative value for no output
+ private int dbgEvaluationOutputIndent = -1;
+
+ /**
* @param udfFinder pass <code>null</code> for default (AnalysisToolPak only)
*/
public WorkbookEvaluator(EvaluationWorkbook workbook, IStabilityClassifier stabilityClassifier, UDFFinder udfFinder) {
@@ -408,17 +418,8 @@ public final class WorkbookEvaluator {
}
- /**
- * whether print detailed messages about the next formula evaluation
- */
- private boolean dbgEvaluationOutputForNextEval = false;
-
- // special logger for formula evaluation output (because of possibly very large output)
- private final POILogger EVAL_LOG = POILogFactory.getLogger("POI.FormulaEval");
- // current indent level for evalution; negative value for no output
- private int dbgEvaluationOutputIndent = -1;
-
// visibility raised for testing
+ @Internal
/* package */ ValueEval evaluateFormula(OperationEvaluationContext ec, Ptg[] ptgs) {
String dbgIndentStr = ""; // always init. to non-null just for defensive avoiding NPE
diff --git a/src/testcases/org/apache/poi/ss/formula/TestWorkbookEvaluator.java b/src/testcases/org/apache/poi/ss/formula/TestWorkbookEvaluator.java
index e9f2dc5c39..c97face949 100644
--- a/src/testcases/org/apache/poi/ss/formula/TestWorkbookEvaluator.java
+++ b/src/testcases/org/apache/poi/ss/formula/TestWorkbookEvaluator.java
@@ -18,7 +18,9 @@
package org.apache.poi.ss.formula;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
@@ -302,6 +304,32 @@ public class TestWorkbookEvaluator {
wb.close();
}
+
+ @Test
+ public void testIgnoreMissingWorkbooks() {
+ // TODO: update this test for meaningful functional behavior
+ WorkbookEvaluator evaluator = new WorkbookEvaluator(null, null, null);
+ assertFalse(evaluator.isIgnoreMissingWorkbooks());
+
+ evaluator.setIgnoreMissingWorkbooks(true);
+ assertTrue(evaluator.isIgnoreMissingWorkbooks());
+
+ evaluator.setIgnoreMissingWorkbooks(false);
+ assertFalse(evaluator.isIgnoreMissingWorkbooks());
+ }
+
+ @Test
+ public void testDebugEvaluationOutputForNextEval() {
+ // TODO: update this test for meaningful functional behavior
+ WorkbookEvaluator evaluator = new WorkbookEvaluator(null, null, null);
+ assertFalse(evaluator.isDebugEvaluationOutputForNextEval());
+
+ evaluator.setDebugEvaluationOutputForNextEval(true);
+ assertTrue(evaluator.isDebugEvaluationOutputForNextEval());
+
+ evaluator.setDebugEvaluationOutputForNextEval(false);
+ assertFalse(evaluator.isDebugEvaluationOutputForNextEval());
+ }
// Test IF-Equals Formula Evaluation (bug 58591)