#783 企业微信模块增加群聊相关接口
* 实现消息推送的服务,添加发送应用消息的方法 * 添加创建群聊会话方法,去除不需要的类 * 完成群聊会话的修改和获取 * 重构群聊服务,提出到单独的服务类里面 * 完成群聊的测试
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user