1
0
mirror of synced 2026-10-29 19:56:18 +08:00

添加群发支持

This commit is contained in:
Daniel Qian
2014-08-25 11:01:09 +08:00
parent 71215bbe79
commit f326d7e72e
20 changed files with 682 additions and 60 deletions

View File

@@ -12,7 +12,7 @@ public class WxCustomMessageTest {
public void testTextReply() {
WxCustomMessage reply = new WxCustomMessage();
reply.setTouser("OPENID");
reply.setMsgtype(WxConsts.MSG_TEXT);
reply.setMsgtype(WxConsts.CUSTOM_MSG_TEXT);
reply.setContent("sfsfdsdf");
Assert.assertEquals(reply.toJson(), "{\"touser\":\"OPENID\",\"msgtype\":\"text\",\"text\":{\"content\":\"sfsfdsdf\"}}");
}
@@ -20,7 +20,7 @@ public class WxCustomMessageTest {
public void testImageReply() {
WxCustomMessage reply = new WxCustomMessage();
reply.setTouser("OPENID");
reply.setMsgtype(WxConsts.MSG_IMAGE);
reply.setMsgtype(WxConsts.CUSTOM_MSG_IMAGE);
reply.setMedia_id("MEDIA_ID");
Assert.assertEquals(reply.toJson(), "{\"touser\":\"OPENID\",\"msgtype\":\"image\",\"image\":{\"media_id\":\"MEDIA_ID\"}}");
}
@@ -28,7 +28,7 @@ public class WxCustomMessageTest {
public void testVoiceReply() {
WxCustomMessage reply = new WxCustomMessage();
reply.setTouser("OPENID");
reply.setMsgtype(WxConsts.MSG_VOICE);
reply.setMsgtype(WxConsts.CUSTOM_MSG_VOICE);
reply.setMedia_id("MEDIA_ID");
Assert.assertEquals(reply.toJson(), "{\"touser\":\"OPENID\",\"msgtype\":\"voice\",\"voice\":{\"media_id\":\"MEDIA_ID\"}}");
}
@@ -36,7 +36,7 @@ public class WxCustomMessageTest {
public void testVideoReply() {
WxCustomMessage reply = new WxCustomMessage();
reply.setTouser("OPENID");
reply.setMsgtype(WxConsts.MSG_VIDEO);
reply.setMsgtype(WxConsts.CUSTOM_MSG_VIDEO);
reply.setMedia_id("MEDIA_ID");
reply.setThumb_media_id("MEDIA_ID");
reply.setTitle("TITLE");
@@ -47,7 +47,7 @@ public class WxCustomMessageTest {
public void testMusicReply() {
WxCustomMessage reply = new WxCustomMessage();
reply.setTouser("OPENID");
reply.setMsgtype(WxConsts.MSG_MUSIC);
reply.setMsgtype(WxConsts.CUSTOM_MSG_MUSIC);
reply.setThumb_media_id("MEDIA_ID");
reply.setDescription("DESCRIPTION");
reply.setTitle("TITLE");
@@ -59,7 +59,7 @@ public class WxCustomMessageTest {
public void testNewsReply() {
WxCustomMessage reply = new WxCustomMessage();
reply.setTouser("OPENID");
reply.setMsgtype(WxConsts.MSG_NEWS);
reply.setMsgtype(WxConsts.CUSTOM_MSG_NEWS);
WxArticle article1 = new WxArticle();
article1.setUrl("URL");

View File

@@ -39,7 +39,7 @@ public class WxXmlMessageTest {
Assert.assertEquals(wxMessage.getToUserName(), "toUser");
Assert.assertEquals(wxMessage.getFromUserName(), "fromUser");
Assert.assertEquals(wxMessage.getCreateTime(), new Long(1348831860l));
Assert.assertEquals(wxMessage.getMsgType(), WxConsts.MSG_TEXT);
Assert.assertEquals(wxMessage.getMsgType(), WxConsts.XML_MSG_TEXT);
Assert.assertEquals(wxMessage.getContent(), "this is a test");
Assert.assertEquals(wxMessage.getMsgId(), new Long(1234567890123456l));
Assert.assertEquals(wxMessage.getPicUrl(), "this is a url");
@@ -66,7 +66,7 @@ public class WxXmlMessageTest {
wxMessage.setToUserName("toUser");
wxMessage.setFromUserName("fromUser");
wxMessage.setCreateTime(new Long(1348831860l));
wxMessage.setMsgType(WxConsts.MSG_TEXT);
wxMessage.setMsgType(WxConsts.XML_MSG_TEXT);
wxMessage.setContent("this is a test");
wxMessage.setMsgId(new Long(1234567890123456l));
wxMessage.setPicUrl("this is a url");