aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2016-10-05 20:13:38 +0000
committerDominik Stadler <centic@apache.org>2016-10-05 20:13:38 +0000
commitc5dbecedab984c4110dfd75b474c511cedd32a8d (patch)
tree880651b1fb0e9641e7c7be208165e2469deae791
parente65020bb72ffb7f8ef0003758137b9513ad91ef8 (diff)
downloadpoi-c5dbecedab984c4110dfd75b474c511cedd32a8d.tar.gz
poi-c5dbecedab984c4110dfd75b474c511cedd32a8d.zip
Bug 59958: Add simple test-case
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1763487 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationSheet.java2
-rw-r--r--src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFEvaluationSheet.java55
2 files changed, 56 insertions, 1 deletions
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationSheet.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationSheet.java
index 7d9d0286f3..fb042afaf4 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationSheet.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFEvaluationSheet.java
@@ -87,7 +87,7 @@ final class XSSFEvaluationSheet implements EvaluationSheet {
evalcell = new XSSFEvaluationCell(cell, this);
_cellCache.put(key, evalcell);
}
-
+
return evalcell;
}
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFEvaluationSheet.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFEvaluationSheet.java
new file mode 100644
index 0000000000..1b1417fbb3
--- /dev/null
+++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFEvaluationSheet.java
@@ -0,0 +1,55 @@
+/* ====================================================================
+ 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.xssf.usermodel;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class TestXSSFEvaluationSheet {
+
+ @Test
+ public void test() throws Exception {
+ XSSFWorkbook wb = new XSSFWorkbook();
+ XSSFSheet sheet = wb.createSheet("test");
+ XSSFRow row = sheet.createRow(0);
+ row.createCell(0);
+ XSSFEvaluationSheet evalsheet = new XSSFEvaluationSheet(sheet);
+
+ assertNotNull("Cell 0,0 is found", evalsheet.getCell(0, 0));
+ assertNull("Cell 0,1 is not found", evalsheet.getCell(0, 1));
+ assertNull("Cell 1,0 is not found", evalsheet.getCell(1, 0));
+
+ // now add Cell 0,1
+ row.createCell(1);
+
+ assertNotNull("Cell 0,0 is found", evalsheet.getCell(0, 0));
+ assertNotNull("Cell 0,1 is now also found", evalsheet.getCell(0, 1));
+ assertNull("Cell 1,0 is not found", evalsheet.getCell(1, 0));
+
+ // after clearing all values it also works
+ row.createCell(2);
+ evalsheet.clearAllCachedResultValues();
+
+ assertNotNull("Cell 0,0 is found", evalsheet.getCell(0, 0));
+ assertNotNull("Cell 0,2 is now also found", evalsheet.getCell(0, 2));
+ assertNull("Cell 1,0 is not found", evalsheet.getCell(1, 0));
+
+ // other things
+ assertEquals(sheet, evalsheet.getXSSFSheet());
+ }
+} \ No newline at end of file