forked from houko/SpringBootUnity
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest11.java
More file actions
40 lines (33 loc) · 1.43 KB
/
Test11.java
File metadata and controls
40 lines (33 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import info.xiaomo.application.ApplicationMain;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import java.io.IOException;
import java.util.List;
import static info.xiaomo.core.untils.ExcelUtil.getListData;
/**
* @author 小莫 (https://xiaomo.info) (https://github.com/syoubaku)
* @version : 2017/1/13 18:33
*/
@RunWith(SpringJUnit4ClassRunner.class) // SpringJUnit支持,由此引入Spring-Test框架支持!
@SpringApplicationConfiguration(classes = ApplicationMain.class) // 指定我们SpringBoot工程的Application启动类
@WebAppConfiguration // 由于是Web项目,Junit需要模拟ServletContext,因此我们需要给我们的测试类加上@WebAppConfiguration。
public class Test11 {
// @Autowired
// private
// CountryDao dao;
@Test
public void test() throws IOException {
List<List<String>> listData = getListData("E:\\thinkpage_cities.xls", 1);
for (List<String> listDatum : listData) {
// CountryModel model = new CountryModel();
// model.setCityName(listDatum.get(0));
// model.setName(listDatum.get(1));
// model.setCreateTime(new Date());
// model.setUpdateTime(new Date());
// dao.save(model);
}
}
}