Skip to content

Commit 0287fb5

Browse files
committed
#698 企业微信OA数据接口单元测试代码优化
1 parent cf78cd5 commit 0287fb5

File tree

1 file changed

+12
-30
lines changed

1 file changed

+12
-30
lines changed
Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package me.chanjar.weixin.cp.api.impl;
22

3+
import com.google.common.collect.Lists;
34
import com.google.gson.Gson;
45
import com.google.inject.Inject;
56
import me.chanjar.weixin.common.error.WxErrorException;
@@ -16,52 +17,33 @@
1617
import java.util.Date;
1718
import java.util.List;
1819

20+
import static org.assertj.core.api.Assertions.assertThat;
21+
1922
/**
2023
* @author Element
21-
* @Package me.chanjar.weixin.cp.api.impl
2224
* @date 2019-04-20 13:46
23-
* @Description: TODO
2425
*/
25-
2626
@Guice(modules = ApiTestModule.class)
2727
public class WxCpOAServiceImplTest {
28-
2928
@Inject
3029
protected WxCpService wxService;
3130

32-
@Inject
33-
protected Gson gson;
34-
3531
@Test
3632
public void testGetCheckinData() throws ParseException, WxErrorException {
37-
Date starttime,endtime;
38-
List<String> userLists = new ArrayList<>();
39-
40-
starttime = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.parse("2019-01-01");
41-
endtime = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.parse("2019-01-20");
33+
Date startTime = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.parse("2019-04-11");
34+
Date endTime = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.parse("2019-05-10");
4235

43-
userLists.add("1");
44-
userLists.add("2");
45-
userLists.add("3");
46-
47-
List<WxCpCheckinData> results = wxService.getOAService().getCheckinData(1, starttime,endtime,userLists);
48-
49-
System.out.println("results ");
50-
System.out.println(gson.toJson(results));
36+
List<WxCpCheckinData> results = wxService.getOAService()
37+
.getCheckinData(1, startTime, endTime, Lists.newArrayList("binary"));
5138

39+
assertThat(results).isNotNull();
5240
}
5341

5442
@Test
55-
public void testGetCheckinOption() throws WxErrorException{
56-
43+
public void testGetCheckinOption() throws WxErrorException {
5744
Date now = new Date();
58-
List<String> userLists = new ArrayList<>();
59-
60-
userLists.add("[email protected]");
61-
62-
List<WxCpCheckinOption> results = wxService.getOAService().getCheckinOption(now,userLists);
63-
64-
System.out.println("results ");
65-
System.out.println(gson.toJson(results));
45+
List<WxCpCheckinOption> results = wxService.getOAService()
46+
.getCheckinOption(now, Lists.newArrayList("binary"));
47+
assertThat(results).isNotNull();
6648
}
6749
}

0 commit comments

Comments
 (0)