mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-09-19 18:22:27 +08:00
重构WxConsts类,对所有常量进行分类整理,便于阅读使用
This commit is contained in:
@@ -31,7 +31,7 @@ public class WxMaMsgServiceImplTest {
|
||||
TestConfig configStorage = (TestConfig) this.wxService
|
||||
.getWxMaConfig();
|
||||
WxMaKefuMessage message = new WxMaKefuMessage();
|
||||
message.setMsgType(WxConsts.CUSTOM_MSG_MPNEWS);
|
||||
message.setMsgType(WxConsts.KefuMsgType.MPNEWS);
|
||||
message.setToUser(configStorage.getOpenid());
|
||||
|
||||
this.wxService.getMsgService().sendKefuMsg(message);
|
||||
@@ -41,7 +41,7 @@ public class WxMaMsgServiceImplTest {
|
||||
TestConfig config = (TestConfig) this.wxService
|
||||
.getWxMaConfig();
|
||||
WxMaKefuMessage message = new WxMaKefuMessage();
|
||||
message.setMsgType(WxConsts.CUSTOM_MSG_TEXT);
|
||||
message.setMsgType(WxConsts.KefuMsgType.TEXT);
|
||||
message.setToUser(config.getOpenid());
|
||||
message.setContent(
|
||||
"欢迎欢迎,热烈欢迎\n换行测试\n超链接:<a href=\"http://www.baidu.com\">Hello World</a>");
|
||||
|
@@ -13,7 +13,7 @@ public class WxMaKefuMessageTest {
|
||||
public void testTextReply() {
|
||||
WxMaKefuMessage reply = new WxMaKefuMessage();
|
||||
reply.setToUser("OPENID");
|
||||
reply.setMsgType(WxConsts.CUSTOM_MSG_TEXT);
|
||||
reply.setMsgType(WxConsts.KefuMsgType.TEXT);
|
||||
reply.setContent("sfsfdsdf");
|
||||
Assert.assertEquals(reply.toJson(), "{\"touser\":\"OPENID\",\"msgtype\":\"text\",\"text\":{\"content\":\"sfsfdsdf\"}}");
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public class WxMaKefuMessageTest {
|
||||
public void testImageReply() {
|
||||
WxMaKefuMessage reply = new WxMaKefuMessage();
|
||||
reply.setToUser("OPENID");
|
||||
reply.setMsgType(WxConsts.CUSTOM_MSG_IMAGE);
|
||||
reply.setMsgType(WxConsts.KefuMsgType.IMAGE);
|
||||
reply.setMediaId("MEDIA_ID");
|
||||
Assert.assertEquals(reply.toJson(), "{\"touser\":\"OPENID\",\"msgtype\":\"image\",\"image\":{\"media_id\":\"MEDIA_ID\"}}");
|
||||
}
|
||||
|
@@ -60,7 +60,7 @@ public class WxMaMessageTest {
|
||||
assertEquals(wxMessage.getToUser(), "toUser");
|
||||
assertEquals(wxMessage.getFromUser(), "fromUser");
|
||||
assertEquals(wxMessage.getCreateTime(), new Long(1348831860L));
|
||||
assertEquals(wxMessage.getMsgType(), WxConsts.XML_MSG_TEXT);
|
||||
assertEquals(wxMessage.getMsgType(), WxConsts.XmlMsgType.TEXT);
|
||||
assertEquals(wxMessage.getContent(), "this is a test");
|
||||
assertEquals(wxMessage.getMsgId(), new Long(1234567890123456L));
|
||||
assertEquals(wxMessage.getPicUrl(), "this is a url");
|
||||
@@ -118,7 +118,7 @@ public class WxMaMessageTest {
|
||||
assertEquals(wxMessage.getToUser(), "toUser");
|
||||
assertEquals(wxMessage.getFromUser(), "fromUser");
|
||||
assertEquals(wxMessage.getCreateTime(), new Integer(1348831860));
|
||||
assertEquals(wxMessage.getMsgType(), WxConsts.XML_MSG_TEXT);
|
||||
assertEquals(wxMessage.getMsgType(), WxConsts.XmlMsgType.TEXT);
|
||||
assertEquals(wxMessage.getContent(), "this is a test");
|
||||
assertEquals(wxMessage.getMsgId(), new Long(1234567890123456L));
|
||||
assertEquals(wxMessage.getPicUrl(), "this is a url");
|
||||
|
Reference in New Issue
Block a user