Search in sources :

Example 1 with WxMpMassGroupMessage

use of me.chanjar.weixin.mp.bean.WxMpMassGroupMessage in project weixin-java-tools by chanjarster.

the class WxMpMassMessageAPITest method testTextMassGroupMessageSend.

@Test
public void testTextMassGroupMessageSend() throws WxErrorException {
    WxMpMassGroupMessage massMessage = new WxMpMassGroupMessage();
    massMessage.setMsgtype(WxConsts.MASS_MSG_TEXT);
    massMessage.setContent("测试群发消息\n欢迎欢迎,热烈欢迎\n换行测试\n超链接:<a href=\"http://www.baidu.com\">Hello World</a>");
    massMessage.setGroupId(wxService.groupGet().get(0).getId());
    WxMpMassSendResult massResult = wxService.massGroupMessageSend(massMessage);
    Assert.assertNotNull(massResult);
    Assert.assertNotNull(massResult.getMsgId());
}
Also used : WxMpMassGroupMessage(me.chanjar.weixin.mp.bean.WxMpMassGroupMessage) WxMpMassSendResult(me.chanjar.weixin.mp.bean.result.WxMpMassSendResult) Test(org.testng.annotations.Test)

Example 2 with WxMpMassGroupMessage

use of me.chanjar.weixin.mp.bean.WxMpMassGroupMessage in project weixin-java-tools by chanjarster.

the class WxMpMassMessageAPITest method testMediaMassGroupMessageSend.

@Test(dataProvider = "massMessages")
public void testMediaMassGroupMessageSend(String massMsgType, String mediaId) throws WxErrorException, IOException {
    WxMpMassGroupMessage massMessage = new WxMpMassGroupMessage();
    massMessage.setMsgtype(massMsgType);
    massMessage.setMediaId(mediaId);
    massMessage.setGroupId(wxService.groupGet().get(0).getId());
    WxMpMassSendResult massResult = wxService.massGroupMessageSend(massMessage);
    Assert.assertNotNull(massResult);
    Assert.assertNotNull(massResult.getMsgId());
}
Also used : WxMpMassGroupMessage(me.chanjar.weixin.mp.bean.WxMpMassGroupMessage) WxMpMassSendResult(me.chanjar.weixin.mp.bean.result.WxMpMassSendResult) Test(org.testng.annotations.Test)

Aggregations

WxMpMassGroupMessage (me.chanjar.weixin.mp.bean.WxMpMassGroupMessage)2 WxMpMassSendResult (me.chanjar.weixin.mp.bean.result.WxMpMassSendResult)2 Test (org.testng.annotations.Test)2