Skip to content

Commit 4812697

Browse files
committed
消灭不规范代码(由sonatype检测出来的)
1 parent 1524de2 commit 4812697

File tree

1 file changed

+104
-104
lines changed

1 file changed

+104
-104
lines changed

weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/message/WxMpXmlMessageTest.java

Lines changed: 104 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -10,76 +10,76 @@ public class WxMpXmlMessageTest {
1010
public void testFromXml() {
1111

1212
String xml = "<xml>"
13-
+ "<ToUserName><![CDATA[toUser]]></ToUserName>"
14-
+ "<FromUserName><![CDATA[fromUser]]></FromUserName> "
15-
+ "<CreateTime>1348831860</CreateTime>"
16-
+ "<MsgType><![CDATA[text]]></MsgType>"
17-
+ "<Content><![CDATA[this is a test]]></Content>"
18-
+ "<MsgId>1234567890123456</MsgId>"
19-
+ "<PicUrl><![CDATA[this is a url]]></PicUrl>"
20-
+ "<MediaId><![CDATA[media_id]]></MediaId>"
21-
+ "<Format><![CDATA[Format]]></Format>"
22-
+ "<ThumbMediaId><![CDATA[thumb_media_id]]></ThumbMediaId>"
23-
+ "<Location_X>23.134521</Location_X>"
24-
+ "<Location_Y>113.358803</Location_Y>"
25-
+ "<Scale>20</Scale>"
26-
+ "<Label><![CDATA[位置信息]]></Label>"
27-
+ "<Description><![CDATA[公众平台官网链接]]></Description>"
28-
+ "<Url><![CDATA[url]]></Url>"
29-
+ "<Title><![CDATA[公众平台官网链接]]></Title>"
30-
+ "<Event><![CDATA[subscribe]]></Event>"
31-
+ "<EventKey><![CDATA[qrscene_123123]]></EventKey>"
32-
+ "<Ticket><![CDATA[TICKET]]></Ticket>"
33-
+ "<Latitude>23.137466</Latitude>"
34-
+ "<Longitude>113.352425</Longitude>"
35-
+ "<Precision>119.385040</Precision>"
36-
+ "<ScanCodeInfo>"
37-
+ " <ScanType><![CDATA[qrcode]]></ScanType>"
38-
+ " <ScanResult><![CDATA[1]]></ScanResult>"
39-
+ "</ScanCodeInfo>"
40-
+ "<SendPicsInfo>"
41-
+ " <Count>1</Count>\n"
42-
+ " <PicList>"
43-
+ " <item>"
44-
+ " <PicMd5Sum><![CDATA[1b5f7c23b5bf75682a53e7b6d163e185]]></PicMd5Sum>"
45-
+ " </item>"
46-
+ " </PicList>"
47-
+ "</SendPicsInfo>"
48-
+ "<SendLocationInfo>"
49-
+ " <Location_X><![CDATA[23]]></Location_X>\n"
50-
+ " <Location_Y><![CDATA[113]]></Location_Y>\n"
51-
+ " <Scale><![CDATA[15]]></Scale>\n"
52-
+ " <Label><![CDATA[ 广州市海珠区客村艺苑路 106号]]></Label>\n"
53-
+ " <Poiname><![CDATA[wo de poi]]></Poiname>\n"
54-
+ "</SendLocationInfo>"
55-
+ "</xml>";
13+
+ "<ToUserName><![CDATA[toUser]]></ToUserName>"
14+
+ "<FromUserName><![CDATA[fromUser]]></FromUserName> "
15+
+ "<CreateTime>1348831860</CreateTime>"
16+
+ "<MsgType><![CDATA[text]]></MsgType>"
17+
+ "<Content><![CDATA[this is a test]]></Content>"
18+
+ "<MsgId>1234567890123456</MsgId>"
19+
+ "<PicUrl><![CDATA[this is a url]]></PicUrl>"
20+
+ "<MediaId><![CDATA[media_id]]></MediaId>"
21+
+ "<Format><![CDATA[Format]]></Format>"
22+
+ "<ThumbMediaId><![CDATA[thumb_media_id]]></ThumbMediaId>"
23+
+ "<Location_X>23.134521</Location_X>"
24+
+ "<Location_Y>113.358803</Location_Y>"
25+
+ "<Scale>20</Scale>"
26+
+ "<Label><![CDATA[位置信息]]></Label>"
27+
+ "<Description><![CDATA[公众平台官网链接]]></Description>"
28+
+ "<Url><![CDATA[url]]></Url>"
29+
+ "<Title><![CDATA[公众平台官网链接]]></Title>"
30+
+ "<Event><![CDATA[subscribe]]></Event>"
31+
+ "<EventKey><![CDATA[qrscene_123123]]></EventKey>"
32+
+ "<Ticket><![CDATA[TICKET]]></Ticket>"
33+
+ "<Latitude>23.137466</Latitude>"
34+
+ "<Longitude>113.352425</Longitude>"
35+
+ "<Precision>119.385040</Precision>"
36+
+ "<ScanCodeInfo>"
37+
+ " <ScanType><![CDATA[qrcode]]></ScanType>"
38+
+ " <ScanResult><![CDATA[1]]></ScanResult>"
39+
+ "</ScanCodeInfo>"
40+
+ "<SendPicsInfo>"
41+
+ " <Count>1</Count>\n"
42+
+ " <PicList>"
43+
+ " <item>"
44+
+ " <PicMd5Sum><![CDATA[1b5f7c23b5bf75682a53e7b6d163e185]]></PicMd5Sum>"
45+
+ " </item>"
46+
+ " </PicList>"
47+
+ "</SendPicsInfo>"
48+
+ "<SendLocationInfo>"
49+
+ " <Location_X><![CDATA[23]]></Location_X>\n"
50+
+ " <Location_Y><![CDATA[113]]></Location_Y>\n"
51+
+ " <Scale><![CDATA[15]]></Scale>\n"
52+
+ " <Label><![CDATA[ 广州市海珠区客村艺苑路 106号]]></Label>\n"
53+
+ " <Poiname><![CDATA[wo de poi]]></Poiname>\n"
54+
+ "</SendLocationInfo>"
55+
+ "</xml>";
5656
WxMpXmlMessage wxMessage = WxMpXmlMessage.fromXml(xml);
5757
Assert.assertEquals(wxMessage.getToUser(), "toUser");
5858
Assert.assertEquals(wxMessage.getFromUser(), "fromUser");
59-
Assert.assertEquals(wxMessage.getCreateTime(), new Long(1348831860l));
59+
Assert.assertEquals(wxMessage.getCreateTime(), new Long(1348831860L));
6060
Assert.assertEquals(wxMessage.getMsgType(), WxConsts.XML_MSG_TEXT);
6161
Assert.assertEquals(wxMessage.getContent(), "this is a test");
62-
Assert.assertEquals(wxMessage.getMsgId(), new Long(1234567890123456l));
62+
Assert.assertEquals(wxMessage.getMsgId(), new Long(1234567890123456L));
6363
Assert.assertEquals(wxMessage.getPicUrl(), "this is a url");
6464
Assert.assertEquals(wxMessage.getMediaId(), "media_id");
6565
Assert.assertEquals(wxMessage.getFormat(), "Format");
6666
Assert.assertEquals(wxMessage.getThumbMediaId(), "thumb_media_id");
67-
Assert.assertEquals(wxMessage.getLocationX(), new Double(23.134521d));
68-
Assert.assertEquals(wxMessage.getLocationY(), new Double(113.358803d));
69-
Assert.assertEquals(wxMessage.getScale(), new Double(20));
67+
Assert.assertEquals(wxMessage.getLocationX(), 23.134521d);
68+
Assert.assertEquals(wxMessage.getLocationY(), 113.358803d);
69+
Assert.assertEquals(wxMessage.getScale(), 20d);
7070
Assert.assertEquals(wxMessage.getLabel(), "位置信息");
7171
Assert.assertEquals(wxMessage.getDescription(), "公众平台官网链接");
7272
Assert.assertEquals(wxMessage.getUrl(), "url");
7373
Assert.assertEquals(wxMessage.getTitle(), "公众平台官网链接");
7474
Assert.assertEquals(wxMessage.getEvent(), "subscribe");
7575
Assert.assertEquals(wxMessage.getEventKey(), "qrscene_123123");
7676
Assert.assertEquals(wxMessage.getTicket(), "TICKET");
77-
Assert.assertEquals(wxMessage.getLatitude(), new Double(23.137466));
78-
Assert.assertEquals(wxMessage.getLongitude(), new Double(113.352425));
79-
Assert.assertEquals(wxMessage.getPrecision(), new Double(119.385040));
77+
Assert.assertEquals(wxMessage.getLatitude(), 23.137466);
78+
Assert.assertEquals(wxMessage.getLongitude(), 113.352425);
79+
Assert.assertEquals(wxMessage.getPrecision(), 119.385040);
8080
Assert.assertEquals(wxMessage.getScanCodeInfo().getScanType(), "qrcode");
8181
Assert.assertEquals(wxMessage.getScanCodeInfo().getScanResult(), "1");
82-
Assert.assertEquals(wxMessage.getSendPicsInfo().getCount(), new Long(1l));
82+
Assert.assertEquals(wxMessage.getSendPicsInfo().getCount(), new Long(1L));
8383
Assert.assertEquals(wxMessage.getSendPicsInfo().getPicList().get(0).getPicMd5Sum(), "1b5f7c23b5bf75682a53e7b6d163e185");
8484
Assert.assertEquals(wxMessage.getSendLocationInfo().getLocationX(), "23");
8585
Assert.assertEquals(wxMessage.getSendLocationInfo().getLocationY(), "113");
@@ -91,76 +91,76 @@ public void testFromXml() {
9191
public void testFromXml2() {
9292

9393
String xml = "<xml>"
94-
+ "<ToUserName><![CDATA[toUser]]></ToUserName>"
95-
+ "<FromUserName><![CDATA[fromUser]]></FromUserName> "
96-
+ "<CreateTime>1348831860</CreateTime>"
97-
+ "<MsgType><![CDATA[text]]></MsgType>"
98-
+ "<Content><![CDATA[this is a test]]></Content>"
99-
+ "<MsgID>1234567890123456</MsgID>"
100-
+ "<PicUrl><![CDATA[this is a url]]></PicUrl>"
101-
+ "<MediaId><![CDATA[media_id]]></MediaId>"
102-
+ "<Format><![CDATA[Format]]></Format>"
103-
+ "<ThumbMediaId><![CDATA[thumb_media_id]]></ThumbMediaId>"
104-
+ "<Location_X>23.134521</Location_X>"
105-
+ "<Location_Y>113.358803</Location_Y>"
106-
+ "<Scale>20</Scale>"
107-
+ "<Label><![CDATA[位置信息]]></Label>"
108-
+ "<Description><![CDATA[公众平台官网链接]]></Description>"
109-
+ "<Url><![CDATA[url]]></Url>"
110-
+ "<Title><![CDATA[公众平台官网链接]]></Title>"
111-
+ "<Event><![CDATA[subscribe]]></Event>"
112-
+ "<EventKey><![CDATA[qrscene_123123]]></EventKey>"
113-
+ "<Ticket><![CDATA[TICKET]]></Ticket>"
114-
+ "<Latitude>23.137466</Latitude>"
115-
+ "<Longitude>113.352425</Longitude>"
116-
+ "<Precision>119.385040</Precision>"
117-
+ "<ScanCodeInfo>"
118-
+ " <ScanType><![CDATA[qrcode]]></ScanType>"
119-
+ " <ScanResult><![CDATA[1]]></ScanResult>"
120-
+ "</ScanCodeInfo>"
121-
+ "<SendPicsInfo>"
122-
+ " <Count>1</Count>\n"
123-
+ " <PicList>"
124-
+ " <item>"
125-
+ " <PicMd5Sum><![CDATA[1b5f7c23b5bf75682a53e7b6d163e185]]></PicMd5Sum>"
126-
+ " </item>"
127-
+ " </PicList>"
128-
+ "</SendPicsInfo>"
129-
+ "<SendLocationInfo>"
130-
+ " <Location_X><![CDATA[23]]></Location_X>\n"
131-
+ " <Location_Y><![CDATA[113]]></Location_Y>\n"
132-
+ " <Scale><![CDATA[15]]></Scale>\n"
133-
+ " <Label><![CDATA[ 广州市海珠区客村艺苑路 106号]]></Label>\n"
134-
+ " <Poiname><![CDATA[wo de poi]]></Poiname>\n"
135-
+ "</SendLocationInfo>"
136-
+ "</xml>";
94+
+ "<ToUserName><![CDATA[toUser]]></ToUserName>"
95+
+ "<FromUserName><![CDATA[fromUser]]></FromUserName> "
96+
+ "<CreateTime>1348831860</CreateTime>"
97+
+ "<MsgType><![CDATA[text]]></MsgType>"
98+
+ "<Content><![CDATA[this is a test]]></Content>"
99+
+ "<MsgID>1234567890123456</MsgID>"
100+
+ "<PicUrl><![CDATA[this is a url]]></PicUrl>"
101+
+ "<MediaId><![CDATA[media_id]]></MediaId>"
102+
+ "<Format><![CDATA[Format]]></Format>"
103+
+ "<ThumbMediaId><![CDATA[thumb_media_id]]></ThumbMediaId>"
104+
+ "<Location_X>23.134521</Location_X>"
105+
+ "<Location_Y>113.358803</Location_Y>"
106+
+ "<Scale>20</Scale>"
107+
+ "<Label><![CDATA[位置信息]]></Label>"
108+
+ "<Description><![CDATA[公众平台官网链接]]></Description>"
109+
+ "<Url><![CDATA[url]]></Url>"
110+
+ "<Title><![CDATA[公众平台官网链接]]></Title>"
111+
+ "<Event><![CDATA[subscribe]]></Event>"
112+
+ "<EventKey><![CDATA[qrscene_123123]]></EventKey>"
113+
+ "<Ticket><![CDATA[TICKET]]></Ticket>"
114+
+ "<Latitude>23.137466</Latitude>"
115+
+ "<Longitude>113.352425</Longitude>"
116+
+ "<Precision>119.385040</Precision>"
117+
+ "<ScanCodeInfo>"
118+
+ " <ScanType><![CDATA[qrcode]]></ScanType>"
119+
+ " <ScanResult><![CDATA[1]]></ScanResult>"
120+
+ "</ScanCodeInfo>"
121+
+ "<SendPicsInfo>"
122+
+ " <Count>1</Count>\n"
123+
+ " <PicList>"
124+
+ " <item>"
125+
+ " <PicMd5Sum><![CDATA[1b5f7c23b5bf75682a53e7b6d163e185]]></PicMd5Sum>"
126+
+ " </item>"
127+
+ " </PicList>"
128+
+ "</SendPicsInfo>"
129+
+ "<SendLocationInfo>"
130+
+ " <Location_X><![CDATA[23]]></Location_X>\n"
131+
+ " <Location_Y><![CDATA[113]]></Location_Y>\n"
132+
+ " <Scale><![CDATA[15]]></Scale>\n"
133+
+ " <Label><![CDATA[ 广州市海珠区客村艺苑路 106号]]></Label>\n"
134+
+ " <Poiname><![CDATA[wo de poi]]></Poiname>\n"
135+
+ "</SendLocationInfo>"
136+
+ "</xml>";
137137
WxMpXmlMessage wxMessage = WxMpXmlMessage.fromXml(xml);
138138
Assert.assertEquals(wxMessage.getToUser(), "toUser");
139139
Assert.assertEquals(wxMessage.getFromUser(), "fromUser");
140-
Assert.assertEquals(wxMessage.getCreateTime(), new Long(1348831860l));
140+
Assert.assertEquals(wxMessage.getCreateTime(), new Long(1348831860L));
141141
Assert.assertEquals(wxMessage.getMsgType(), WxConsts.XML_MSG_TEXT);
142142
Assert.assertEquals(wxMessage.getContent(), "this is a test");
143-
Assert.assertEquals(wxMessage.getMsgId(), new Long(1234567890123456l));
143+
Assert.assertEquals(wxMessage.getMsgId(), new Long(1234567890123456L));
144144
Assert.assertEquals(wxMessage.getPicUrl(), "this is a url");
145145
Assert.assertEquals(wxMessage.getMediaId(), "media_id");
146146
Assert.assertEquals(wxMessage.getFormat(), "Format");
147147
Assert.assertEquals(wxMessage.getThumbMediaId(), "thumb_media_id");
148-
Assert.assertEquals(wxMessage.getLocationX(), new Double(23.134521d));
149-
Assert.assertEquals(wxMessage.getLocationY(), new Double(113.358803d));
150-
Assert.assertEquals(wxMessage.getScale(), new Double(20));
148+
Assert.assertEquals(wxMessage.getLocationX(), 23.134521d);
149+
Assert.assertEquals(wxMessage.getLocationY(), 113.358803d);
150+
Assert.assertEquals(wxMessage.getScale(), 20d);
151151
Assert.assertEquals(wxMessage.getLabel(), "位置信息");
152152
Assert.assertEquals(wxMessage.getDescription(), "公众平台官网链接");
153153
Assert.assertEquals(wxMessage.getUrl(), "url");
154154
Assert.assertEquals(wxMessage.getTitle(), "公众平台官网链接");
155155
Assert.assertEquals(wxMessage.getEvent(), "subscribe");
156156
Assert.assertEquals(wxMessage.getEventKey(), "qrscene_123123");
157157
Assert.assertEquals(wxMessage.getTicket(), "TICKET");
158-
Assert.assertEquals(wxMessage.getLatitude(), new Double(23.137466));
159-
Assert.assertEquals(wxMessage.getLongitude(), new Double(113.352425));
160-
Assert.assertEquals(wxMessage.getPrecision(), new Double(119.385040));
158+
Assert.assertEquals(wxMessage.getLatitude(), 23.137466);
159+
Assert.assertEquals(wxMessage.getLongitude(), 113.352425);
160+
Assert.assertEquals(wxMessage.getPrecision(), 119.385040);
161161
Assert.assertEquals(wxMessage.getScanCodeInfo().getScanType(), "qrcode");
162162
Assert.assertEquals(wxMessage.getScanCodeInfo().getScanResult(), "1");
163-
Assert.assertEquals(wxMessage.getSendPicsInfo().getCount(), new Long(1l));
163+
Assert.assertEquals(wxMessage.getSendPicsInfo().getCount(), new Long(1L));
164164
Assert.assertEquals(wxMessage.getSendPicsInfo().getPicList().get(0).getPicMd5Sum(), "1b5f7c23b5bf75682a53e7b6d163e185");
165165
Assert.assertEquals(wxMessage.getSendLocationInfo().getLocationX(), "23");
166166
Assert.assertEquals(wxMessage.getSendLocationInfo().getLocationY(), "113");

0 commit comments

Comments
 (0)