File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
SpringBootExcel/src/test/java/com/titstory/heowc Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 11package com .titstory .heowc ;
22
3+ import com .titstory .heowc .component .ExcelReadComponent ;
4+ import com .titstory .heowc .domain .Product ;
5+ import org .apache .poi .openxml4j .exceptions .InvalidFormatException ;
36import org .junit .Test ;
47import org .junit .runner .RunWith ;
8+ import org .springframework .beans .factory .annotation .Autowired ;
59import org .springframework .boot .test .context .SpringBootTest ;
610import org .springframework .test .context .junit4 .SpringRunner ;
711
12+ import java .io .File ;
13+ import java .io .IOException ;
14+
815@ RunWith (SpringRunner .class )
916@ SpringBootTest
1017public class SpringBootExcelApplicationTests {
1118
19+ @ Autowired
20+ ExcelReadComponent excelReadComponent ;
21+
1222 @ Test
13- public void contextLoads () {
23+ public void test_readExcel () throws IOException , InvalidFormatException {
24+ File xlsxFile = new File ("{path}\\ test.xlsx" );
25+
26+ excelReadComponent
27+ .readExcelToList (xlsxFile , Product ::new )
28+ .forEach (System .out ::println );
1429 }
1530
1631}
You can’t perform that action at this time.
0 commit comments