@@ -65,8 +65,8 @@ public interface WxCpService { | |||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=上传下载多媒体文件 | |||
* </pre> | |||
* | |||
* @param mediaType 媒体类型, 请看{@link WxCpConsts} | |||
* @param fileType 文件类型,请看{@link WxCpConsts} | |||
* @param mediaType 媒体类型, 请看{@link WxConsts} | |||
* @param fileType 文件类型,请看{@link WxConsts} | |||
* @param inputStream 输入流 | |||
* @throws WxErrorException | |||
*/ | |||
@@ -65,12 +65,12 @@ public class WxCpMessage { | |||
/** | |||
* <pre> | |||
* 请使用 | |||
* {@link me.chanjar.weixin.cp.api.WxCpConsts#CUSTOM_MSG_TEXT} | |||
* {@link me.chanjar.weixin.cp.api.WxCpConsts#CUSTOM_MSG_IMAGE} | |||
* {@link me.chanjar.weixin.cp.api.WxCpConsts#CUSTOM_MSG_VOICE} | |||
* {@link me.chanjar.weixin.cp.api.WxCpConsts#CUSTOM_MSG_MUSIC} | |||
* {@link me.chanjar.weixin.cp.api.WxCpConsts#CUSTOM_MSG_VIDEO} | |||
* {@link me.chanjar.weixin.cp.api.WxCpConsts#CUSTOM_MSG_NEWS} | |||
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_TEXT} | |||
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_IMAGE} | |||
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_VOICE} | |||
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_MUSIC} | |||
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_VIDEO} | |||
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_NEWS} | |||
* </pre> | |||
* @param msgType | |||
*/ | |||
@@ -190,13 +190,13 @@ public class WxCpXmlMessage { | |||
/** | |||
* <pre> | |||
* 当接受用户消息时,可能会获得以下值: | |||
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_TEXT} | |||
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_IMAGE} | |||
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_VOICE} | |||
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_VIDEO} | |||
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_LOCATION} | |||
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_LINK} | |||
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_EVENT} | |||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_TEXT} | |||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_IMAGE} | |||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_VOICE} | |||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_VIDEO} | |||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_LOCATION} | |||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_LINK} | |||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_EVENT} | |||
* </pre> | |||
* | |||
* @return | |||
@@ -208,11 +208,11 @@ public class WxCpXmlMessage { | |||
/** | |||
* <pre> | |||
* 当发送消息的时候使用: | |||
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_TEXT} | |||
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_IMAGE} | |||
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_VOICE} | |||
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_VIDEO} | |||
* {@link me.chanjar.weixin.cp.api.WxCpConsts#XML_MSG_NEWS} | |||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_TEXT} | |||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_IMAGE} | |||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_VOICE} | |||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_VIDEO} | |||
* {@link me.chanjar.weixin.common.api.WxConsts#XML_MSG_NEWS} | |||
* </pre> | |||
* | |||
* @param msgType | |||
@@ -1,14 +1,14 @@ | |||
package me.chanjar.weixin.cp.bean; | |||
import me.chanjar.weixin.common.api.WxConsts; | |||
import me.chanjar.weixin.common.util.xml.MediaIdMarshaller; | |||
import javax.xml.bind.annotation.XmlAccessType; | |||
import javax.xml.bind.annotation.XmlAccessorType; | |||
import javax.xml.bind.annotation.XmlElement; | |||
import javax.xml.bind.annotation.XmlRootElement; | |||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; | |||
import me.chanjar.weixin.cp.api.WxCpConsts; | |||
import me.chanjar.weixin.common.util.xml.MediaIdMarshaller; | |||
@XmlRootElement(name = "xml") | |||
@XmlAccessorType(XmlAccessType.FIELD) | |||
public class WxCpXmlOutImageMessage extends WxCpXmlOutMessage { | |||
@@ -18,7 +18,7 @@ public class WxCpXmlOutImageMessage extends WxCpXmlOutMessage { | |||
private String mediaId; | |||
public WxCpXmlOutImageMessage() { | |||
this.msgType = WxCpConsts.XML_MSG_IMAGE; | |||
this.msgType = WxConsts.XML_MSG_IMAGE; | |||
} | |||
public String getMediaId() { | |||
@@ -1,17 +1,12 @@ | |||
package me.chanjar.weixin.cp.bean; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import me.chanjar.weixin.common.api.WxConsts; | |||
import me.chanjar.weixin.common.util.xml.AdapterCDATA; | |||
import javax.xml.bind.annotation.XmlAccessType; | |||
import javax.xml.bind.annotation.XmlAccessorType; | |||
import javax.xml.bind.annotation.XmlElement; | |||
import javax.xml.bind.annotation.XmlElementWrapper; | |||
import javax.xml.bind.annotation.XmlRootElement; | |||
import javax.xml.bind.annotation.*; | |||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; | |||
import me.chanjar.weixin.cp.api.WxCpConsts; | |||
import me.chanjar.weixin.common.util.xml.AdapterCDATA; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
@XmlRootElement(name = "xml") | |||
@XmlAccessorType(XmlAccessType.FIELD) | |||
@@ -25,7 +20,7 @@ public class WxCpXmlOutMewsMessage extends WxCpXmlOutMessage { | |||
protected final List<Item> articles = new ArrayList<Item>(); | |||
public WxCpXmlOutMewsMessage() { | |||
this.msgType = WxCpConsts.XML_MSG_NEWS; | |||
this.msgType = WxConsts.XML_MSG_NEWS; | |||
} | |||
public int getArticleCount() { | |||
@@ -6,7 +6,7 @@ import javax.xml.bind.annotation.XmlElement; | |||
import javax.xml.bind.annotation.XmlRootElement; | |||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; | |||
import me.chanjar.weixin.cp.api.WxCpConsts; | |||
import me.chanjar.weixin.common.api.WxConsts; | |||
import me.chanjar.weixin.common.util.xml.AdapterCDATA; | |||
@XmlRootElement(name = "xml") | |||
@@ -18,7 +18,7 @@ public class WxCpXmlOutTextMessage extends WxCpXmlOutMessage { | |||
private String content; | |||
public WxCpXmlOutTextMessage() { | |||
this.msgType = WxCpConsts.XML_MSG_TEXT; | |||
this.msgType = WxConsts.XML_MSG_TEXT; | |||
} | |||
public String getContent() { | |||
@@ -6,7 +6,7 @@ import javax.xml.bind.annotation.XmlElement; | |||
import javax.xml.bind.annotation.XmlRootElement; | |||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; | |||
import me.chanjar.weixin.cp.api.WxCpConsts; | |||
import me.chanjar.weixin.common.api.WxConsts; | |||
import me.chanjar.weixin.common.util.xml.AdapterCDATA; | |||
@XmlRootElement(name = "xml") | |||
@@ -17,7 +17,7 @@ public class WxCpXmlOutVideoMessage extends WxCpXmlOutMessage { | |||
protected final Video video = new Video(); | |||
public WxCpXmlOutVideoMessage() { | |||
this.msgType = WxCpConsts.XML_MSG_VIDEO; | |||
this.msgType = WxConsts.XML_MSG_VIDEO; | |||
} | |||
public String getMediaId() { | |||
@@ -6,7 +6,7 @@ import javax.xml.bind.annotation.XmlElement; | |||
import javax.xml.bind.annotation.XmlRootElement; | |||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; | |||
import me.chanjar.weixin.cp.api.WxCpConsts; | |||
import me.chanjar.weixin.common.api.WxConsts; | |||
import me.chanjar.weixin.common.util.xml.MediaIdMarshaller; | |||
@XmlRootElement(name = "xml") | |||
@@ -18,7 +18,7 @@ public class WxCpXmlOutVoiceMessage extends WxCpXmlOutMessage { | |||
private String mediaId; | |||
public WxCpXmlOutVoiceMessage() { | |||
this.msgType = WxCpConsts.XML_MSG_VOICE; | |||
this.msgType = WxConsts.XML_MSG_VOICE; | |||
} | |||
public String getMediaId() { | |||
@@ -10,7 +10,7 @@ package me.chanjar.weixin.cp.util.json; | |||
import java.lang.reflect.Type; | |||
import me.chanjar.weixin.cp.api.WxCpConsts; | |||
import me.chanjar.weixin.common.api.WxConsts; | |||
import me.chanjar.weixin.cp.bean.WxCpMessage; | |||
import com.google.gson.JsonArray; | |||
@@ -41,31 +41,31 @@ public class WxCpMessageGsonAdapter implements JsonSerializer<WxCpMessage> { | |||
if (StringUtils.isNotBlank(message.getToTag())) { | |||
messageJson.addProperty("totag", message.getToUser()); | |||
} | |||
if (WxCpConsts.CUSTOM_MSG_TEXT.equals(message.getMsgType())) { | |||
if (WxConsts.CUSTOM_MSG_TEXT.equals(message.getMsgType())) { | |||
JsonObject text = new JsonObject(); | |||
text.addProperty("content", message.getContent()); | |||
messageJson.add("text", text); | |||
} | |||
if (WxCpConsts.CUSTOM_MSG_IMAGE.equals(message.getMsgType())) { | |||
if (WxConsts.CUSTOM_MSG_IMAGE.equals(message.getMsgType())) { | |||
JsonObject image = new JsonObject(); | |||
image.addProperty("media_id", message.getMediaId()); | |||
messageJson.add("image", image); | |||
} | |||
if (WxCpConsts.CUSTOM_MSG_FILE.equals(message.getMsgType())) { | |||
if (WxConsts.CUSTOM_MSG_FILE.equals(message.getMsgType())) { | |||
JsonObject image = new JsonObject(); | |||
image.addProperty("media_id", message.getMediaId()); | |||
messageJson.add("file", image); | |||
} | |||
if (WxCpConsts.CUSTOM_MSG_VOICE.equals(message.getMsgType())) { | |||
if (WxConsts.CUSTOM_MSG_VOICE.equals(message.getMsgType())) { | |||
JsonObject voice = new JsonObject(); | |||
voice.addProperty("media_id", message.getMediaId()); | |||
messageJson.add("voice", voice); | |||
} | |||
if (WxCpConsts.CUSTOM_MSG_VIDEO.equals(message.getMsgType())) { | |||
if (WxConsts.CUSTOM_MSG_VIDEO.equals(message.getMsgType())) { | |||
JsonObject video = new JsonObject(); | |||
video.addProperty("media_id", message.getMediaId()); | |||
video.addProperty("thumb_media_id", message.getThumbMediaId()); | |||
@@ -74,7 +74,7 @@ public class WxCpMessageGsonAdapter implements JsonSerializer<WxCpMessage> { | |||
messageJson.add("video", video); | |||
} | |||
if (WxCpConsts.CUSTOM_MSG_NEWS.equals(message.getMsgType())) { | |||
if (WxConsts.CUSTOM_MSG_NEWS.equals(message.getMsgType())) { | |||
JsonArray articleJsonArray = new JsonArray(); | |||
for (WxCpMessage.WxArticle article : message.getArticles()) { | |||
JsonObject articleJson = new JsonObject(); | |||
@@ -49,10 +49,10 @@ public class WxCpMediaAPITest { | |||
@DataProvider | |||
public Object[][] uploadMedia() { | |||
return new Object[][] { | |||
new Object[] { WxCpConsts.MEDIA_IMAGE, WxCpConsts.FILE_JPG, "mm.jpeg" }, | |||
new Object[] { WxCpConsts.MEDIA_VOICE, WxCpConsts.FILE_MP3, "mm.mp3" }, | |||
new Object[] { WxCpConsts.MEDIA_VIDEO, WxCpConsts.FILE_MP4, "mm.mp4" }, | |||
new Object[] { WxCpConsts.MEDIA_FILE, WxCpConsts.FILE_JPG, "mm.jpeg" } | |||
new Object[] { WxConsts.MEDIA_IMAGE, WxConsts.FILE_JPG, "mm.jpeg" }, | |||
new Object[] { WxConsts.MEDIA_VOICE, WxConsts.FILE_MP3, "mm.mp3" }, | |||
new Object[] { WxConsts.MEDIA_VIDEO, WxConsts.FILE_MP4, "mm.mp4" }, | |||
new Object[] { WxConsts.MEDIA_FILE, WxConsts.FILE_JPG, "mm.jpeg" } | |||
}; | |||
} | |||
@@ -24,7 +24,7 @@ public class WxCpMessageAPITest { | |||
ApiTestModule.WxXmlCpInMemoryConfigStorage configStorage = (ApiTestModule.WxXmlCpInMemoryConfigStorage) wxService.wxCpConfigStorage; | |||
WxCpMessage message1 = new WxCpMessage(); | |||
message1.setAgentId(configStorage.getAgentId()); | |||
message1.setMsgType(WxCpConsts.CUSTOM_MSG_TEXT); | |||
message1.setMsgType(WxConsts.CUSTOM_MSG_TEXT); | |||
message1.setToUser(configStorage.getUserId()); | |||
message1.setContent("欢迎欢迎,热烈欢迎\n换行测试\n超链接:<a href=\"http://www.baidu.com\">Hello World</a>"); | |||
wxService.messageSend(message1); | |||
@@ -21,21 +21,21 @@ public class WxCpMessageRouterTest { | |||
router | |||
.rule() | |||
.async(async) | |||
.msgType(WxCpConsts.XML_MSG_TEXT).event(WxCpConsts.EVT_CLICK).eventKey("KEY_1").content("CONTENT_1") | |||
.msgType(WxConsts.XML_MSG_TEXT).event(WxConsts.EVT_CLICK).eventKey("KEY_1").content("CONTENT_1") | |||
.handler(new WxEchoCpMessageHandler(sb, "COMBINE_4")) | |||
.end() | |||
.rule() | |||
.async(async) | |||
.msgType(WxCpConsts.XML_MSG_TEXT).event(WxCpConsts.EVT_CLICK).eventKey("KEY_1") | |||
.msgType(WxConsts.XML_MSG_TEXT).event(WxConsts.EVT_CLICK).eventKey("KEY_1") | |||
.handler(new WxEchoCpMessageHandler(sb, "COMBINE_3")) | |||
.end() | |||
.rule() | |||
.async(async) | |||
.msgType(WxCpConsts.XML_MSG_TEXT).event(WxCpConsts.EVT_CLICK) | |||
.msgType(WxConsts.XML_MSG_TEXT).event(WxConsts.EVT_CLICK) | |||
.handler(new WxEchoCpMessageHandler(sb, "COMBINE_2")) | |||
.end() | |||
.rule().async(async).msgType(WxCpConsts.XML_MSG_TEXT).handler(new WxEchoCpMessageHandler(sb, WxCpConsts.XML_MSG_TEXT)).end() | |||
.rule().async(async).event(WxCpConsts.EVT_CLICK).handler(new WxEchoCpMessageHandler(sb, WxCpConsts.EVT_CLICK)).end() | |||
.rule().async(async).msgType(WxConsts.XML_MSG_TEXT).handler(new WxEchoCpMessageHandler(sb, WxConsts.XML_MSG_TEXT)).end() | |||
.rule().async(async).event(WxConsts.EVT_CLICK).handler(new WxEchoCpMessageHandler(sb, WxConsts.EVT_CLICK)).end() | |||
.rule().async(async).eventKey("KEY_1").handler(new WxEchoCpMessageHandler(sb, "KEY_1")).end() | |||
.rule().async(async).content("CONTENT_1").handler(new WxEchoCpMessageHandler(sb, "CONTENT_1")).end() | |||
.rule().async(async).rContent(".*bc.*").handler(new WxEchoCpMessageHandler(sb, "abcd")).end() | |||
@@ -91,10 +91,10 @@ public class WxCpMessageRouterTest { | |||
@DataProvider(name="messages-1") | |||
public Object[][] messages2() { | |||
WxCpXmlMessage message1 = new WxCpXmlMessage(); | |||
message1.setMsgType(WxCpConsts.XML_MSG_TEXT); | |||
message1.setMsgType(WxConsts.XML_MSG_TEXT); | |||
WxCpXmlMessage message2 = new WxCpXmlMessage(); | |||
message2.setEvent(WxCpConsts.EVT_CLICK); | |||
message2.setEvent(WxConsts.EVT_CLICK); | |||
WxCpXmlMessage message3 = new WxCpXmlMessage(); | |||
message3.setEventKey("KEY_1"); | |||
@@ -109,23 +109,23 @@ public class WxCpMessageRouterTest { | |||
message6.setContent("abcd"); | |||
WxCpXmlMessage c2 = new WxCpXmlMessage(); | |||
c2.setMsgType(WxCpConsts.XML_MSG_TEXT); | |||
c2.setEvent(WxCpConsts.EVT_CLICK); | |||
c2.setMsgType(WxConsts.XML_MSG_TEXT); | |||
c2.setEvent(WxConsts.EVT_CLICK); | |||
WxCpXmlMessage c3 = new WxCpXmlMessage(); | |||
c3.setMsgType(WxCpConsts.XML_MSG_TEXT); | |||
c3.setEvent(WxCpConsts.EVT_CLICK); | |||
c3.setMsgType(WxConsts.XML_MSG_TEXT); | |||
c3.setEvent(WxConsts.EVT_CLICK); | |||
c3.setEventKey("KEY_1"); | |||
WxCpXmlMessage c4 = new WxCpXmlMessage(); | |||
c4.setMsgType(WxCpConsts.XML_MSG_TEXT); | |||
c4.setEvent(WxCpConsts.EVT_CLICK); | |||
c4.setMsgType(WxConsts.XML_MSG_TEXT); | |||
c4.setEvent(WxConsts.EVT_CLICK); | |||
c4.setEventKey("KEY_1"); | |||
c4.setContent("CONTENT_1"); | |||
return new Object[][] { | |||
new Object[] { message1, WxCpConsts.XML_MSG_TEXT + "," }, | |||
new Object[] { message2, WxCpConsts.EVT_CLICK + "," }, | |||
new Object[] { message1, WxConsts.XML_MSG_TEXT + "," }, | |||
new Object[] { message2, WxConsts.EVT_CLICK + "," }, | |||
new Object[] { message3, "KEY_1," }, | |||
new Object[] { message4, "CONTENT_1," }, | |||
new Object[] { message5, "ALL," }, | |||
@@ -44,12 +44,12 @@ public class WxMenuAPITest { | |||
public Object[][] getMenu() throws JAXBException { | |||
WxMenu menu = new WxMenu(); | |||
WxMenuButton button1 = new WxMenuButton(); | |||
button1.setType(WxCpConsts.BUTTON_CLICK); | |||
button1.setType(WxConsts.BUTTON_CLICK); | |||
button1.setName("今日歌曲"); | |||
button1.setKey("V1001_TODAY_MUSIC"); | |||
WxMenuButton button2 = new WxMenuButton(); | |||
button2.setType(WxCpConsts.BUTTON_CLICK); | |||
button2.setType(WxConsts.BUTTON_CLICK); | |||
button2.setName("歌手简介"); | |||
button2.setKey("V1001_TODAY_SINGER"); | |||
@@ -61,17 +61,17 @@ public class WxMenuAPITest { | |||
menu.getButtons().add(button3); | |||
WxMenuButton button31 = new WxMenuButton(); | |||
button31.setType(WxCpConsts.BUTTON_VIEW); | |||
button31.setType(WxConsts.BUTTON_VIEW); | |||
button31.setName("搜索"); | |||
button31.setUrl("http://www.soso.com/"); | |||
WxMenuButton button32 = new WxMenuButton(); | |||
button32.setType(WxCpConsts.BUTTON_VIEW); | |||
button32.setType(WxConsts.BUTTON_VIEW); | |||
button32.setName("视频"); | |||
button32.setUrl("http://v.qq.com/"); | |||
WxMenuButton button33 = new WxMenuButton(); | |||
button33.setType(WxCpConsts.BUTTON_CLICK); | |||
button33.setType(WxConsts.BUTTON_CLICK); | |||
button33.setName("赞一下我们"); | |||
button33.setKey("V1001_GOOD"); | |||
@@ -1,6 +1,6 @@ | |||
package me.chanjar.weixin.cp.bean; | |||
import me.chanjar.weixin.cp.api.WxCpConsts; | |||
import me.chanjar.weixin.common.api.WxConsts; | |||
import org.testng.Assert; | |||
import org.testng.annotations.Test; | |||
@@ -12,7 +12,7 @@ public class WxCpMessageTest { | |||
public void testTextReply() { | |||
WxCpMessage reply = new WxCpMessage(); | |||
reply.setToUser("OPENID"); | |||
reply.setMsgType(WxCpConsts.CUSTOM_MSG_TEXT); | |||
reply.setMsgType(WxConsts.CUSTOM_MSG_TEXT); | |||
reply.setContent("sfsfdsdf"); | |||
Assert.assertEquals(reply.toJson(), "{\"touser\":\"OPENID\",\"msgtype\":\"text\",\"text\":{\"content\":\"sfsfdsdf\"}}"); | |||
} | |||
@@ -25,7 +25,7 @@ public class WxCpMessageTest { | |||
public void testImageReply() { | |||
WxCpMessage reply = new WxCpMessage(); | |||
reply.setToUser("OPENID"); | |||
reply.setMsgType(WxCpConsts.CUSTOM_MSG_IMAGE); | |||
reply.setMsgType(WxConsts.CUSTOM_MSG_IMAGE); | |||
reply.setMediaId("MEDIA_ID"); | |||
Assert.assertEquals(reply.toJson(), "{\"touser\":\"OPENID\",\"msgtype\":\"image\",\"image\":{\"media_id\":\"MEDIA_ID\"}}"); | |||
} | |||
@@ -38,7 +38,7 @@ public class WxCpMessageTest { | |||
public void testVoiceReply() { | |||
WxCpMessage reply = new WxCpMessage(); | |||
reply.setToUser("OPENID"); | |||
reply.setMsgType(WxCpConsts.CUSTOM_MSG_VOICE); | |||
reply.setMsgType(WxConsts.CUSTOM_MSG_VOICE); | |||
reply.setMediaId("MEDIA_ID"); | |||
Assert.assertEquals(reply.toJson(), "{\"touser\":\"OPENID\",\"msgtype\":\"voice\",\"voice\":{\"media_id\":\"MEDIA_ID\"}}"); | |||
} | |||
@@ -51,7 +51,7 @@ public class WxCpMessageTest { | |||
public void testVideoReply() { | |||
WxCpMessage reply = new WxCpMessage(); | |||
reply.setToUser("OPENID"); | |||
reply.setMsgType(WxCpConsts.CUSTOM_MSG_VIDEO); | |||
reply.setMsgType(WxConsts.CUSTOM_MSG_VIDEO); | |||
reply.setMediaId("MEDIA_ID"); | |||
reply.setThumbMediaId("MEDIA_ID"); | |||
reply.setTitle("TITLE"); | |||
@@ -67,7 +67,7 @@ public class WxCpMessageTest { | |||
public void testNewsReply() { | |||
WxCpMessage reply = new WxCpMessage(); | |||
reply.setToUser("OPENID"); | |||
reply.setMsgType(WxCpConsts.CUSTOM_MSG_NEWS); | |||
reply.setMsgType(WxConsts.CUSTOM_MSG_NEWS); | |||
WxArticle article1 = new WxArticle(); | |||
article1.setUrl("URL"); | |||
@@ -1,6 +1,6 @@ | |||
package me.chanjar.weixin.cp.bean; | |||
import me.chanjar.weixin.cp.api.WxCpConsts; | |||
import me.chanjar.weixin.common.api.WxConsts; | |||
import org.testng.Assert; | |||
import org.testng.annotations.Test; | |||
@@ -57,7 +57,7 @@ public class WxCpXmlMessageTest { | |||
Assert.assertEquals(wxMessage.getToUserName(), "toUser"); | |||
Assert.assertEquals(wxMessage.getFromUserName(), "fromUser"); | |||
Assert.assertEquals(wxMessage.getCreateTime(), new Long(1348831860l)); | |||
Assert.assertEquals(wxMessage.getMsgType(), WxCpConsts.XML_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"); | |||