mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-09-24 04:53:50 +08:00
issue #12 xml消息fromXml, toXml有错误
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package chanjarster.weixin.bean;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test
|
||||
public class WxXmlOutIMusicMessageTest {
|
||||
|
||||
public void test() {
|
||||
WxXmlOutMusicMessage m = new WxXmlOutMusicMessage();
|
||||
m.setTitle("title");
|
||||
m.setDescription("ddfff");
|
||||
m.setCreateTime(1122l);
|
||||
m.setFromUserName("fromUser");
|
||||
m.setToUserName("toUser");
|
||||
m.setHQMusicUrl("hQMusicUrl");
|
||||
m.setMusicUrl("musicUrl");
|
||||
m.setThumbMediaId("thumbMediaId");
|
||||
|
||||
String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
|
||||
+ "<xml>"
|
||||
+ "<ToUserName><![CDATA[toUser]]></ToUserName>"
|
||||
+ "<FromUserName><![CDATA[fromUser]]></FromUserName>"
|
||||
+ "<CreateTime>1122</CreateTime>"
|
||||
+ "<MsgType><![CDATA[music]]></MsgType>"
|
||||
+ "<Music>"
|
||||
+ " <Title><![CDATA[title]]></Title>"
|
||||
+ " <Description><![CDATA[ddfff]]></Description>"
|
||||
+ " <ThumbMediaId><![CDATA[thumbMediaId]]></ThumbMediaId>"
|
||||
+ " <MusicUrl><![CDATA[musicUrl]]></MusicUrl>"
|
||||
+ " <HQMusicUrl><![CDATA[hQMusicUrl]]></HQMusicUrl>"
|
||||
+ " </Music>"
|
||||
+ "</xml>";
|
||||
System.out.println(m.toXml());
|
||||
Assert.assertEquals(m.toXml().replaceAll("\\s", ""), expected.replaceAll("\\s", ""));
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user