重构WxConsts类,对所有常量进行分类整理,便于阅读使用

This commit is contained in:
Binary Wang
2017-11-07 11:41:55 +08:00
parent f65e2fbdb8
commit 2146372502
62 changed files with 427 additions and 393 deletions

View File

@@ -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>");

View File

@@ -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\"}}");
}

View File

@@ -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");