1
0
mirror of synced 2025-12-25 20:17:56 +08:00

#783 企业微信模块增加群聊相关接口

* 实现消息推送的服务,添加发送应用消息的方法

* 添加创建群聊会话方法,去除不需要的类

* 完成群聊会话的修改和获取

* 重构群聊服务,提出到单独的服务类里面

* 完成群聊的测试
This commit is contained in:
gaigeshen
2018-12-18 10:34:53 +08:00
committed by Binary Wang
parent b7d3f839f7
commit 9b6893161a
9 changed files with 298 additions and 6 deletions

View File

@@ -0,0 +1,46 @@
package me.chanjar.weixin.cp.api.impl;
import java.util.Arrays;
import me.chanjar.weixin.cp.bean.WxCpChat;
import org.testng.Assert;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import com.google.inject.Inject;
import me.chanjar.weixin.cp.api.ApiTestModule;
import me.chanjar.weixin.cp.api.WxCpService;
/**
* 测试群聊服务
*
* @author gaigeshen
*/
@Guice(modules = ApiTestModule.class)
public class WxCpChatServiceImplTest {
@Inject
private WxCpService wxCpService;
@Test
public void create() throws Exception {
wxCpService.getChatService().chatCreate("测试群聊", "gaige_shen", Arrays.asList("gaige_shen", "ZhangXiaoMing"), "mychatid");
}
@Test
public void get() throws Exception {
WxCpChat chat = wxCpService.getChatService().chatGet("mychatid");
System.out.println(chat);
Assert.assertEquals(chat.getName(), "测试群聊");
}
@Test
public void update() throws Exception {
wxCpService.getChatService().chatUpdate("mychatid", "", "", Arrays.asList("ZhengWuYao"), null);
WxCpChat chat = wxCpService.getChatService().chatGet("mychatid");
System.out.println(chat);
Assert.assertEquals(chat.getUsers().size(), 3);
}
}