|
1 | 1 | package me.chanjar.weixin.cp.api.impl; |
2 | 2 |
|
| 3 | +import com.google.gson.JsonObject; |
3 | 4 | import com.google.inject.Inject; |
4 | 5 | import me.chanjar.weixin.common.error.WxErrorException; |
5 | 6 | import me.chanjar.weixin.cp.api.ApiTestModule; |
@@ -93,7 +94,7 @@ public void testGetAdminList() throws WxErrorException { |
93 | 94 | me.chanjar.weixin.cp.bean.WxCpTpAdmin adminList = this.wxCpService.getAgentService().getAdminList(agentId); |
94 | 95 |
|
95 | 96 | assertThat(adminList).isNotNull(); |
96 | | - assertThat(adminList.getErrCode()).isEqualTo(0); |
| 97 | + assertThat(adminList.getErrcode()).isEqualTo(0L); |
97 | 98 | } |
98 | 99 |
|
99 | 100 | /** |
@@ -142,15 +143,17 @@ public void testGetAdminList() throws Exception { |
142 | 143 | String returnJson = "{\"errcode\": 0,\"errmsg\": \"ok\",\"admin\": [{\"userid\": \"zhangsan\"," + |
143 | 144 | "\"open_userid\": \"woAJ2GCAAAXtWyujaWJHDDGi0mACH71w\",\"auth_type\": 1}," + |
144 | 145 | "{\"userid\": \"lisi\",\"open_userid\": \"woAJ2GCAAAXtWyujaWJHDDGi0mACH72w\",\"auth_type\": 2}]}"; |
| 146 | + JsonObject requestJson = new JsonObject(); |
| 147 | + requestJson.addProperty("agentid", 9); |
145 | 148 | final WxCpConfigStorage configStorage = new WxCpDefaultConfigImpl(); |
146 | 149 | when(wxService.getWxCpConfigStorage()).thenReturn(configStorage); |
147 | | - when(wxService.post(configStorage.getApiUrl(WxCpApiPathConsts.Agent.AGENT_GET_ADMIN_LIST), "{\"agentid\":9}")).thenReturn(returnJson); |
| 150 | + when(wxService.post(configStorage.getApiUrl(WxCpApiPathConsts.Agent.AGENT_GET_ADMIN_LIST), requestJson.toString())).thenReturn(returnJson); |
148 | 151 | when(wxService.getAgentService()).thenReturn(new WxCpAgentServiceImpl(wxService)); |
149 | 152 |
|
150 | 153 | WxCpAgentService wxAgentService = this.wxService.getAgentService(); |
151 | 154 | me.chanjar.weixin.cp.bean.WxCpTpAdmin adminList = wxAgentService.getAdminList(9); |
152 | 155 |
|
153 | | - assertEquals(0, adminList.getErrCode().intValue()); |
| 156 | + assertEquals(0, adminList.getErrcode().intValue()); |
154 | 157 | assertEquals(2, adminList.getAdmin().size()); |
155 | 158 | assertEquals("zhangsan", adminList.getAdmin().get(0).getUserId()); |
156 | 159 | assertEquals("woAJ2GCAAAXtWyujaWJHDDGi0mACH71w", adminList.getAdmin().get(0).getOpenUserId()); |
|
0 commit comments