|
1 | 1 | import info.xiaomo.application.ApplicationMain;
|
2 | | -import info.xiaomo.application.dao.CountryDao; |
3 | | -import info.xiaomo.application.model.CountryModel; |
4 | 2 | import org.junit.Test;
|
5 | 3 | import org.junit.runner.RunWith;
|
6 | | -import org.springframework.beans.factory.annotation.Autowired; |
7 | 4 | import org.springframework.boot.test.SpringApplicationConfiguration;
|
8 | 5 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
9 | 6 | import org.springframework.test.context.web.WebAppConfiguration;
|
10 | 7 |
|
11 | 8 | import java.io.IOException;
|
12 | | -import java.util.Date; |
13 | 9 | import java.util.List;
|
14 | 10 |
|
15 | 11 | import static info.xiaomo.core.untils.ExcelUtil.getListData;
|
|
23 | 19 | @WebAppConfiguration // 由于是Web项目,Junit需要模拟ServletContext,因此我们需要给我们的测试类加上@WebAppConfiguration。
|
24 | 20 | public class Test11 {
|
25 | 21 |
|
26 | | - @Autowired |
27 | | - private |
28 | | - CountryDao dao; |
| 22 | +// @Autowired |
| 23 | +// private |
| 24 | +// CountryDao dao; |
29 | 25 |
|
30 | 26 | @Test
|
31 | 27 | public void test() throws IOException {
|
32 | 28 | List<List<String>> listData = getListData("E:\\thinkpage_cities.xls", 1);
|
33 | 29 | for (List<String> listDatum : listData) {
|
34 | | - CountryModel model = new CountryModel(); |
35 | | - model.setCityName(listDatum.get(0)); |
36 | | - model.setName(listDatum.get(1)); |
37 | | - model.setCreateTime(new Date()); |
38 | | - model.setUpdateTime(new Date()); |
39 | | - dao.save(model); |
| 30 | +// CountryModel model = new CountryModel(); |
| 31 | +// model.setCityName(listDatum.get(0)); |
| 32 | +// model.setName(listDatum.get(1)); |
| 33 | +// model.setCreateTime(new Date()); |
| 34 | +// model.setUpdateTime(new Date()); |
| 35 | +// dao.save(model); |
40 | 36 | }
|
41 | 37 |
|
42 | 38 | }
|
|
0 commit comments