]> source.dussan.org Git - poi.git/commitdiff
Update tests for bug 63845 some more
authorDominik Stadler <centic@apache.org>
Sun, 25 Oct 2020 07:21:41 +0000 (07:21 +0000)
committerDominik Stadler <centic@apache.org>
Sun, 25 Oct 2020 07:21:41 +0000 (07:21 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1882826 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java

index 4627620bfb2e4713413f3badf3dcc70d621d4ec6..db79c01f65faff8f9a1954a3fa1cd44f44224a67 100644 (file)
@@ -130,7 +130,7 @@ import org.xml.sax.SAXParseException;
 import org.xml.sax.XMLReader;
 
 public final class TestXSSFBugs extends BaseTestBugzillaIssues {
-    private static POILogger LOG = POILogFactory.getLogger(TestXSSFBugs.class);
+    private static final POILogger LOG = POILogFactory.getLogger(TestXSSFBugs.class);
 
     public TestXSSFBugs() {
         super(XSSFITestDataProvider.instance);
@@ -300,15 +300,15 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
             assertEquals("NameB1", b1.getNameName());
             assertEquals("Sheet1", b1.getSheetName());
             assertEquals(-1, b1.getSheetIndex());
-            assertEquals(false, b1.isDeleted());
-            assertEquals(false, b1.isHidden());
+            assertFalse(b1.isDeleted());
+            assertFalse(b1.isHidden());
 
             assertNotNull(b2);
             assertEquals("NameB2", b2.getNameName());
             assertEquals("Sheet1", b2.getSheetName());
             assertEquals(-1, b2.getSheetIndex());
-            assertEquals(false, b2.isDeleted());
-            assertEquals(false, b2.isHidden());
+            assertFalse(b2.isDeleted());
+            assertFalse(b2.isHidden());
 
             assertNotNull(sheet2);
             assertEquals("NameSheet2", sheet2.getNameName());
@@ -3525,11 +3525,19 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
                 Cell cellBack = wbBack.getSheetAt(0).getRow(0).getCell(0);
                 assertNull("Element 'v' should not be set for formulas unless the value was calculated",
                         ((XSSFCell) cellBack).getCTCell().getV());
+                assertNotNull("Formula should be set internally now",
+                        ((XSSFCell) cellBack).getCTCell().getF());
 
                 wbBack.getCreationHelper().createFormulaEvaluator().evaluateInCell(cellBack);
 
                 assertEquals("Element 'v' should be set now as the formula was calculated manually",
                         "0.0", ((XSSFCell) cellBack).getCTCell().getV());
+
+                cellBack.setCellValue("123");
+                assertEquals("String value should be set now",
+                        "123", cellBack.getStringCellValue());
+                assertNull("No formula should be set any more",
+                        ((XSSFCell) cellBack).getCTCell().getF());
             }
         }
     }
@@ -3575,6 +3583,8 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
         //test that an NPE isn't thrown on opening
         try (Workbook wb = XSSFTestDataSamples.openSampleWorkbook("64667.xlsx")) {
             int activeSheet = wb.getActiveSheetIndex();
+            assertEquals(0, activeSheet);
+            assertNotNull(wb.getSheetAt(activeSheet));
         }
     }