mirror of https://github.com/apache/poi.git
[bug-65609] add naive test case
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1893792 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
10e607a1ce
commit
1da3708e8b
|
@ -25,10 +25,12 @@ import static org.junit.jupiter.api.Assertions.fail;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream;
|
||||
import org.apache.poi.ss.tests.usermodel.BaseTestXSheet;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.SXSSFITestDataProvider;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
|
@ -121,6 +123,32 @@ public final class TestSXSSFSheet extends BaseTestXSheet {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void flushBufferedDaat() throws IOException {
|
||||
try (UnsynchronizedByteArrayOutputStream bos = new UnsynchronizedByteArrayOutputStream()) {
|
||||
try (SXSSFWorkbook wb = new SXSSFWorkbook(1)) {
|
||||
SXSSFSheet sheet = wb.createSheet("my-sheet");
|
||||
|
||||
sheet.createRow(1).createCell(0).setCellValue(1);
|
||||
sheet.createRow(2).createCell(0).setCellValue(2);
|
||||
sheet.createRow(3).createCell(0).setCellValue(3);
|
||||
|
||||
sheet.flushBufferedData();
|
||||
|
||||
sheet.createRow(4).createCell(0).setCellValue(4);
|
||||
sheet.createRow(5).createCell(0).setCellValue(5);
|
||||
sheet.createRow(6).createCell(0).setCellValue(6);
|
||||
|
||||
wb.write(bos);
|
||||
}
|
||||
try (XSSFWorkbook wb = new XSSFWorkbook(bos.toInputStream())) {
|
||||
XSSFSheet sheet = wb.getSheet("my-sheet");
|
||||
assertEquals(3, sheet.getRow(3).getCell(0).getNumericCellValue());
|
||||
assertEquals(6, sheet.getRow(6).getCell(0).getNumericCellValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void overrideRowsInTemplate() throws IOException {
|
||||
try (XSSFWorkbook template = new XSSFWorkbook()) {
|
||||
|
|
Loading…
Reference in New Issue