Adjust tests and fix small typo

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1662650 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2015-02-27 09:52:57 +00:00
parent b57a4f04e3
commit 7dfcd6c684
3 changed files with 17 additions and 14 deletions

View 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

View 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());
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());
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());

View 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