File tree Expand file tree Collapse file tree
weixin-java-common/src/main/java/me/chanjar/weixin/common
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package me .chanjar .weixin .common .bean .menu ;
22
3+ import com .google .gson .annotations .SerializedName ;
34import me .chanjar .weixin .common .util .ToStringUtils ;
45
56import java .io .Serializable ;
67
78public class WxMenuRule implements Serializable {
89 private static final long serialVersionUID = -4587181819499286670L ;
910
11+ /**
12+ * 变态的微信接口,反序列化时这里反人类的使用和序列化时不一样的名字
13+ */
14+ @ SerializedName (value = "tag_id" , alternate = "group_id" )
1015 private String tagId ;
1116 private String sex ;
1217 private String country ;
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ protected JsonObject convertToJson(WxMenuRule menuRule) {
7070 return matchRule ;
7171 }
7272
73+ @ Deprecated
7374 private WxMenuRule convertToRule (JsonObject json ) {
7475 WxMenuRule menuRule = new WxMenuRule ();
7576 //变态的微信接口,这里居然反人类的使用和序列化时不一样的名字
Original file line number Diff line number Diff line change 99import me .chanjar .weixin .mp .api .test .ApiTestModule ;
1010import me .chanjar .weixin .mp .bean .menu .WxMpGetSelfMenuInfoResult ;
1111import me .chanjar .weixin .mp .bean .menu .WxMpMenu ;
12- import org .testng .*;
1312import org .testng .annotations .*;
1413
14+ import static org .testng .Assert .*;
15+
1516/**
1617 * 测试菜单
1718 *
@@ -87,6 +88,14 @@ public void testCreateConditionalMenu() throws WxErrorException {
8788 System .out .println (this .menuId );
8889 }
8990
91+ @ Test (dependsOnMethods = {"testCreateConditionalMenu" })
92+ public void testMenuGet_AfterCreateConditionalMenu () throws WxErrorException {
93+ WxMpMenu wxMenu = this .wxService .getMenuService ().menuGet ();
94+ assertNotNull (wxMenu );
95+ System .out .println (wxMenu .toJson ());
96+ assertNotNull (wxMenu .getConditionalMenu ().get (0 ).getRule ().getTagId ());
97+ }
98+
9099 @ Test (dependsOnMethods = {"testCreateConditionalMenu" })
91100 public void testDeleteConditionalMenu () throws WxErrorException {
92101 this .wxService .getMenuService ().menuDelete (menuId );
@@ -134,7 +143,7 @@ public void testCreateMenu_by_json() throws WxErrorException {
134143 @ Test (dependsOnMethods = {"testMenuCreate" })
135144 public void testMenuGet () throws WxErrorException {
136145 WxMpMenu wxMenu = this .wxService .getMenuService ().menuGet ();
137- Assert . assertNotNull (wxMenu );
146+ assertNotNull (wxMenu );
138147 System .out .println (wxMenu .toJson ());
139148 }
140149
You can’t perform that action at this time.
0 commit comments