aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2018-12-28 19:53:13 +0000
committerDominik Stadler <centic@apache.org>2018-12-28 19:53:13 +0000
commit22bdfcf39996980ab46cbfb3340a58861a89097a (patch)
tree69de91d76ee31480b0599664ed7d1aba117110c0 /src/testcases
parent2b8200f7d701ea6ff9638f629f0bd81d2e48410c (diff)
downloadpoi-22bdfcf39996980ab46cbfb3340a58861a89097a.tar.gz
poi-22bdfcf39996980ab46cbfb3340a58861a89097a.zip
Run Cell-tests on HSSF as well and make handling of null-values consistent across implementations
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1849881 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases')
-rw-r--r--src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java
index 3228bbd0a1..304faaadaf 100644
--- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java
+++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java
@@ -1062,6 +1062,49 @@ public abstract class BaseTestCell {
}
@Test
+ public void test62216() throws IOException {
+ try (Workbook wb = _testDataProvider.createWorkbook()) {
+ Cell instance = wb.createSheet().createRow(0).createCell(0);
+ String formula = "2";
+ instance.setCellFormula(formula);
+ instance.setCellErrorValue(FormulaError.NAME.getCode());
+
+ assertEquals(formula, instance.getCellFormula());
+ }
+ }
+
+ @Test
+ public void testSetNullValues() throws IOException {
+ Workbook wb = _testDataProvider.createWorkbook();
+ Cell cell = wb.createSheet("test").createRow(0).createCell(0);
+
+ cell.setCellValue((Calendar)null);
+ assertEquals(CellType.BLANK, cell.getCellType());
+ assertEquals("", cell.getStringCellValue());
+
+ cell.setCellValue((Date)null);
+ assertEquals(CellType.BLANK, cell.getCellType());
+ assertEquals("", cell.getStringCellValue());
+
+ cell.setCellValue((String)null);
+ assertEquals(CellType.BLANK, cell.getCellType());
+ assertEquals("", cell.getStringCellValue());
+
+ assertEquals(CellType.BLANK, cell.getCellType());
+ assertEquals("", cell.getStringCellValue());
+
+ cell.setCellValue((RichTextString) null);
+ assertEquals(CellType.BLANK, cell.getCellType());
+ assertEquals("", cell.getStringCellValue());
+
+ cell.setCellValue((String)null);
+ assertEquals(CellType.BLANK, cell.getCellType());
+ assertEquals("", cell.getStringCellValue());
+
+ wb.close();
+ }
+
+ @Test
public void testFormulaSetValueDoesNotChangeType() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Sheet sheet = wb.createSheet();