]> source.dussan.org Git - poi.git/commitdiff
testBool/testErr: check values before writeOutAndReadBack
authorJaven O'Neal <onealj@apache.org>
Mon, 30 Nov 2015 05:21:01 +0000 (05:21 +0000)
committerJaven O'Neal <onealj@apache.org>
Mon, 30 Nov 2015 05:21:01 +0000 (05:21 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1717178 13f79535-47bb-0310-9956-ffa450edef68

src/testcases/org/apache/poi/ss/usermodel/BaseTestCell.java

index b56d34cea2a4154c607e6721d3e7d16aab5d9b15..de405f77b95847953913992e4c4345f3b225204c 100644 (file)
@@ -156,13 +156,16 @@ public abstract class BaseTestCell {
         assertEquals(0, c.getRowIndex());
         assertEquals(1, c.getColumnIndex());
         c.setCellValue(true);
+        assertEquals("B1 value", true, c.getBooleanCellValue());
 
         // C1
         c=r.createCell(2);
         assertEquals(0, c.getRowIndex());
         assertEquals(2, c.getColumnIndex());
         c.setCellValue(false);
+        assertEquals("C1 value", false, c.getBooleanCellValue());
 
+        // Make sure values are saved and re-read correctly.
         Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
         wb1.close();
         
@@ -203,12 +206,14 @@ public abstract class BaseTestCell {
         assertEquals(0, c.getRowIndex());
         assertEquals(1, c.getColumnIndex());
         c.setCellErrorValue(FormulaError.NULL.getCode());
+        assertEquals("B1 value == #NULL!", FormulaError.NULL.getCode(), c.getErrorCellValue());
 
         // C1
         c=r.createCell(2);
         assertEquals(0, c.getRowIndex());
         assertEquals(2, c.getColumnIndex());
         c.setCellErrorValue(FormulaError.DIV0.getCode());
+        assertEquals("C1 value == #DIV/0!", FormulaError.DIV0.getCode(), c.getErrorCellValue());
 
         Workbook wb2 = _testDataProvider.writeOutAndReadBack(wb1);
         wb1.close();
@@ -219,12 +224,16 @@ public abstract class BaseTestCell {
         assertEquals("Row 1 should have 2 cells", 2, r.getPhysicalNumberOfCells());
 
         c = r.getCell(1);
+        assertEquals(0, c.getRowIndex());
+        assertEquals(1, c.getColumnIndex());
         assertEquals(Cell.CELL_TYPE_ERROR, c.getCellType());
-        assertEquals("B2 value == #NULL!", FormulaError.NULL.getCode(), c.getErrorCellValue());
+        assertEquals("B1 value == #NULL!", FormulaError.NULL.getCode(), c.getErrorCellValue());
 
         c = r.getCell(2);
+        assertEquals(0, c.getRowIndex());
+        assertEquals(2, c.getColumnIndex());
         assertEquals(Cell.CELL_TYPE_ERROR, c.getCellType());
-        assertEquals("C2 value == #DIV/0!", FormulaError.DIV0.getCode(), c.getErrorCellValue());
+        assertEquals("C1 value == #DIV/0!", FormulaError.DIV0.getCode(), c.getErrorCellValue());
 
         wb2.close();
     }