Browse Source

新增测试案例

pull/2144/head
Jiaju Zhuang 3 years ago
parent
commit
4e4aeead8e
  1. 7
      src/test/java/com/alibaba/easyexcel/test/core/large/LargeDataTest.java

7
src/test/java/com/alibaba/easyexcel/test/core/large/LargeDataTest.java

@ -14,6 +14,7 @@ import org.apache.poi.xssf.streaming.SXSSFCell;
import org.apache.poi.xssf.streaming.SXSSFRow; import org.apache.poi.xssf.streaming.SXSSFRow;
import org.apache.poi.xssf.streaming.SXSSFSheet; import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook; import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.junit.Assert;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.FixMethodOrder; import org.junit.FixMethodOrder;
import org.junit.Test; import org.junit.Test;
@ -92,7 +93,8 @@ public class LargeDataTest {
LOGGER.info("{} write success.", j); LOGGER.info("{} write success.", j);
} }
excelWriter.finish(); excelWriter.finish();
LOGGER.info("write cost:{}", System.currentTimeMillis() - start); long cost = System.currentTimeMillis() - start;
LOGGER.info("write cost:{}", cost);
start = System.currentTimeMillis(); start = System.currentTimeMillis();
try (FileOutputStream fileOutputStream = new FileOutputStream(fileWritePoi07)) { try (FileOutputStream fileOutputStream = new FileOutputStream(fileWritePoi07)) {
SXSSFWorkbook workbook = new SXSSFWorkbook(); SXSSFWorkbook workbook = new SXSSFWorkbook();
@ -111,8 +113,9 @@ public class LargeDataTest {
workbook.dispose(); workbook.dispose();
workbook.close(); workbook.close();
} }
long costPoi = System.currentTimeMillis() - start;
LOGGER.info("poi write cost:{}", System.currentTimeMillis() - start); LOGGER.info("poi write cost:{}", System.currentTimeMillis() - start);
Assert.assertTrue(costPoi * 3 > cost);
} }
private List<LargeData> data() { private List<LargeData> data() {

Loading…
Cancel
Save