|
|
@ -1,20 +1,11 @@ |
|
|
|
package com.alibaba.easyexcel.test.core.excludeorinclude; |
|
|
|
package com.alibaba.easyexcel.test.core.excludeorinclude; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.HashSet; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.easyexcel.test.util.TestFileUtil; |
|
|
|
import com.alibaba.easyexcel.test.util.TestFileUtil; |
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
|
|
|
|
import org.junit.jupiter.api.*; |
|
|
|
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.Assertions; |
|
|
|
import java.io.File; |
|
|
|
import org.junit.jupiter.api.BeforeAll; |
|
|
|
import java.util.*; |
|
|
|
import org.junit.jupiter.api.MethodOrderer; |
|
|
|
|
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
|
|
import org.junit.jupiter.api.TestMethodOrder; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author Jiaju Zhuang |
|
|
|
* @author Jiaju Zhuang |
|
|
@ -203,7 +194,9 @@ public class ExcludeOrIncludeDataTest { |
|
|
|
Set<String> includeColumnFieldNames = new HashSet<String>(); |
|
|
|
Set<String> includeColumnFieldNames = new HashSet<String>(); |
|
|
|
includeColumnFieldNames.add("column2"); |
|
|
|
includeColumnFieldNames.add("column2"); |
|
|
|
includeColumnFieldNames.add("column3"); |
|
|
|
includeColumnFieldNames.add("column3"); |
|
|
|
EasyExcel.write(file, ExcludeOrIncludeData.class).includeColumnFieldNames(includeColumnFieldNames).sheet() |
|
|
|
EasyExcel.write(file, ExcludeOrIncludeData.class) |
|
|
|
|
|
|
|
.sheet() |
|
|
|
|
|
|
|
.includeColumnFieldNames(includeColumnFieldNames) |
|
|
|
.doWrite(data()); |
|
|
|
.doWrite(data()); |
|
|
|
List<Map<Integer, String>> dataMap = EasyExcel.read(file).sheet().doReadSync(); |
|
|
|
List<Map<Integer, String>> dataMap = EasyExcel.read(file).sheet().doReadSync(); |
|
|
|
Assertions.assertEquals(1, dataMap.size()); |
|
|
|
Assertions.assertEquals(1, dataMap.size()); |
|
|
|