]> source.dussan.org Git - poi.git/commitdiff
Adjust tests and fix small typo
authorDominik Stadler <centic@apache.org>
Fri, 27 Feb 2015 09:52:57 +0000 (09:52 +0000)
committerDominik Stadler <centic@apache.org>
Fri, 27 Feb 2015 09:52:57 +0000 (09:52 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1662650 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java
src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java

index 87d8847bdec27024bf9a872ed3a61f30fea1d240..79d2cc83b7494fd94431c18ba6fd2356fcd81af2 100644 (file)
@@ -831,7 +831,7 @@ public class SXSSFWorkbook implements Workbook
 
     /**
      * Closes the underlying {@link XSSFWorkbook} and {@link OPCPackage} 
-     *  on which this Workbook is based, if any. Has no effect on Worbooks
+     *  on which this Workbook is based, if any. Has no effect on Workbooks
      *  created from scratch.
      */
     @Override
index ce217e234424b81581e6f588fd245087dd252f69..7aa9422a620e8d85a2c3bbf12843d38670778a54 100644 (file)
@@ -88,19 +88,23 @@ public final class TestSXSSFWorkbook extends BaseTestWorkbook {
     }
 
     @Test
-    public void existingWorkbook() {
+    public void existingWorkbook() throws IOException {
        XSSFWorkbook xssfWorkbook = new XSSFWorkbook();
        xssfWorkbook.createSheet("S1");
        SXSSFWorkbook wb = new SXSSFWorkbook(xssfWorkbook);
-       xssfWorkbook = (XSSFWorkbook) SXSSFITestDataProvider.instance.writeOutAndReadBack(wb);
-       assertTrue(wb.dispose());
-
-        wb = new SXSSFWorkbook(xssfWorkbook);
-       assertEquals(1, wb.getNumberOfSheets());
-       Sheet sheet  = wb.getSheetAt(0);
-       assertNotNull(sheet);
-       assertEquals("S1", sheet.getSheetName());
-        assertTrue(wb.dispose());
+       try {
+               xssfWorkbook = (XSSFWorkbook) SXSSFITestDataProvider.instance.writeOutAndReadBack(wb);
+               assertTrue(wb.dispose());
+    
+            wb = new SXSSFWorkbook(xssfWorkbook);
+               assertEquals(1, wb.getNumberOfSheets());
+               Sheet sheet  = wb.getSheetAt(0);
+               assertNotNull(sheet);
+               assertEquals("S1", sheet.getSheetName());
+       } finally {
+           assertTrue(wb.dispose());
+           wb.close();
+       }
 
     }
 
@@ -123,7 +127,7 @@ public final class TestSXSSFWorkbook extends BaseTestWorkbook {
         XSSFWorkbook xssfWorkbook = (XSSFWorkbook) SXSSFITestDataProvider.instance.writeOutAndReadBack(wb);
         sss = (SharedStringsTable)f.get(wb);
         assertEquals(2, sss.getUniqueCount());
-        wb.dispose();
+        assertTrue(wb.dispose());
 
         Sheet sheet1 = xssfWorkbook.getSheetAt(0);
         assertEquals("S1", sheet1.getSheetName());
index 36a48f46f6a54396d5ea2aab88133c42cca80228..066c12e7f1ed59cdb195bc1ae999401149edb20f 100644 (file)
@@ -33,7 +33,6 @@ import org.apache.poi.hssf.record.StringRecord;
 import org.apache.poi.ss.SpreadsheetVersion;
 import org.apache.poi.ss.usermodel.BaseTestCell;
 import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.ErrorConstants;
 import org.apache.poi.ss.usermodel.FormulaError;
 import org.apache.poi.ss.usermodel.RichTextString;
 import org.apache.poi.ss.usermodel.Row;
@@ -330,7 +329,7 @@ public final class TestHSSFCell extends BaseTestCell {
                // string to error code
                cell.setCellValue("abc");
                confirmStringRecord(sheet, true);
-               cell.setCellErrorValue((byte)ErrorConstants.ERROR_REF);
+               cell.setCellErrorValue(FormulaError.REF.getCode());
                confirmStringRecord(sheet, false);
 
                // string to boolean