mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-06-28 13:16:19 +08:00
#698 企业微信OA数据接口单元测试代码优化
This commit is contained in:
parent
cf78cd52d2
commit
0287fb565b
@ -1,5 +1,6 @@
|
||||
package me.chanjar.weixin.cp.api.impl;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.inject.Inject;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
@ -16,52 +17,33 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* @author Element
|
||||
* @Package me.chanjar.weixin.cp.api.impl
|
||||
* @date 2019-04-20 13:46
|
||||
* @Description: TODO
|
||||
*/
|
||||
|
||||
@Guice(modules = ApiTestModule.class)
|
||||
public class WxCpOAServiceImplTest {
|
||||
|
||||
@Inject
|
||||
protected WxCpService wxService;
|
||||
|
||||
@Inject
|
||||
protected Gson gson;
|
||||
|
||||
@Test
|
||||
public void testGetCheckinData() throws ParseException, WxErrorException {
|
||||
Date starttime,endtime;
|
||||
List<String> userLists = new ArrayList<>();
|
||||
Date startTime = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.parse("2019-04-11");
|
||||
Date endTime = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.parse("2019-05-10");
|
||||
|
||||
starttime = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.parse("2019-01-01");
|
||||
endtime = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.parse("2019-01-20");
|
||||
|
||||
userLists.add("1");
|
||||
userLists.add("2");
|
||||
userLists.add("3");
|
||||
|
||||
List<WxCpCheckinData> results = wxService.getOAService().getCheckinData(1, starttime,endtime,userLists);
|
||||
|
||||
System.out.println("results ");
|
||||
System.out.println(gson.toJson(results));
|
||||
List<WxCpCheckinData> results = wxService.getOAService()
|
||||
.getCheckinData(1, startTime, endTime, Lists.newArrayList("binary"));
|
||||
|
||||
assertThat(results).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCheckinOption() throws WxErrorException{
|
||||
|
||||
public void testGetCheckinOption() throws WxErrorException {
|
||||
Date now = new Date();
|
||||
List<String> userLists = new ArrayList<>();
|
||||
|
||||
userLists.add("user@aliyun.com");
|
||||
|
||||
List<WxCpCheckinOption> results = wxService.getOAService().getCheckinOption(now,userLists);
|
||||
|
||||
System.out.println("results ");
|
||||
System.out.println(gson.toJson(results));
|
||||
List<WxCpCheckinOption> results = wxService.getOAService()
|
||||
.getCheckinOption(now, Lists.newArrayList("binary"));
|
||||
assertThat(results).isNotNull();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user