Search in sources :

Example 1 with WxMpMassOpenIdsMessage

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

the class WxMpMassMessageAPITest method testTextMassOpenIdsMessageSend.

@Test
public void testTextMassOpenIdsMessageSend() throws WxErrorException {
    // 发送群发消息
    ApiTestModule.WxXmlMpInMemoryConfigStorage configProvider = (ApiTestModule.WxXmlMpInMemoryConfigStorage) wxService.wxMpConfigStorage;
    WxMpMassOpenIdsMessage massMessage = new WxMpMassOpenIdsMessage();
    massMessage.setMsgType(WxConsts.MASS_MSG_TEXT);
    massMessage.setContent("测试群发消息\n欢迎欢迎,热烈欢迎\n换行测试\n超链接:<a href=\"http://www.baidu.com\">Hello World</a>");
    massMessage.getToUsers().add(configProvider.getOpenId());
    WxMpMassSendResult massResult = wxService.massOpenIdsMessageSend(massMessage);
    Assert.assertNotNull(massResult);
    Assert.assertNotNull(massResult.getMsgId());
}
Also used : WxMpMassSendResult(me.chanjar.weixin.mp.bean.result.WxMpMassSendResult) WxMpMassOpenIdsMessage(me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage) Test(org.testng.annotations.Test)

Example 2 with WxMpMassOpenIdsMessage

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

the class WxMpMassMessageAPITest method testMediaMassOpenIdsMessageSend.

@Test(dataProvider = "massMessages")
public void testMediaMassOpenIdsMessageSend(String massMsgType, String mediaId) throws WxErrorException, IOException {
    // 发送群发消息
    ApiTestModule.WxXmlMpInMemoryConfigStorage configProvider = (ApiTestModule.WxXmlMpInMemoryConfigStorage) wxService.wxMpConfigStorage;
    WxMpMassOpenIdsMessage massMessage = new WxMpMassOpenIdsMessage();
    massMessage.setMsgType(massMsgType);
    massMessage.setMediaId(mediaId);
    massMessage.getToUsers().add(configProvider.getOpenId());
    WxMpMassSendResult massResult = wxService.massOpenIdsMessageSend(massMessage);
    Assert.assertNotNull(massResult);
    Assert.assertNotNull(massResult.getMsgId());
}
Also used : WxMpMassSendResult(me.chanjar.weixin.mp.bean.result.WxMpMassSendResult) WxMpMassOpenIdsMessage(me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage) Test(org.testng.annotations.Test)

Aggregations

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