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());
}
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());
}
Aggregations