增加 ExcelUtil getReader(String bookFilePath, String sheetName) 方法支持

This commit is contained in:
Say.li
2022-03-24 14:20:34 +08:00
parent 24457bff69
commit 1400911bb8
4 changed files with 37 additions and 0 deletions

View File

@@ -4,6 +4,9 @@ import cn.hutool.poi.excel.cell.CellLocation;
import org.junit.Assert;
import org.junit.Test;
import java.util.List;
import java.util.Map;
public class ExcelUtilTest {
@Test
@@ -50,4 +53,12 @@ public class ExcelUtilTest {
writer.writeCellValue(1, 2, "设置值");
writer.close();
}
@Test
public void getReaderByBookFilePathAndSheetNameTest() {
ExcelReader reader = ExcelUtil.getReader("aaa.xlsx", "12");
List<Map<String, Object>> list = reader.readAll();
reader.close();
Assert.assertEquals(1L, list.get(1).get("鞋码"));
}
}