diff --git a/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java b/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java index 43375eff8..3fad35edc 100644 --- a/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java +++ b/src/java/org/apache/poi/ss/formula/WorkbookEvaluator.java @@ -113,6 +113,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 null for default (AnalysisToolPak only) */ @@ -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 e9f2dc5c3..c97face94 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)