@Test public void testList() throws WxErrorException { List<WxCpAgent> list = this.wxCpService.getAgentService().list(); assertThat(list).isNotEmpty(); assertThat(list.get(0).getAgentId()).isNotNull(); assertThat(list.get(0).getName()).isNotEmpty(); assertThat(list.get(0).getSquareLogoUrl()).isNotEmpty(); }
@Override public List<WxCpAgent> list() throws WxErrorException { String url = "https: String responseContent = this.mainService.get(url, null); JsonObject jsonObject = JSON_PARSER.parse(responseContent).getAsJsonObject(); if (jsonObject.get("errcode").getAsInt() != 0) { throw new WxErrorException(WxError.fromJson(responseContent)); } return WxCpGsonBuilder.create().fromJson(jsonObject.get("agentlist").toString(), new TypeToken<List<WxCpAgent>>() { }.getType()); }
WxCpAgentServiceImpl implements WxCpAgentService { @Override public List<WxCpAgent> list() throws WxErrorException { String url = "https: String responseContent = this.mainService.get(url, null); JsonObject jsonObject = JSON_PARSER.parse(responseContent).getAsJsonObject(); if (jsonObject.get("errcode").getAsInt() != 0) { throw new WxErrorException(WxError.fromJson(responseContent)); } return WxCpGsonBuilder.create().fromJson(jsonObject.get("agentlist").toString(), new TypeToken<List<WxCpAgent>>() { }.getType()); } }
WxCpAgentServiceImpl implements WxCpAgentService { @Override public List<WxCpAgent> list() throws WxErrorException { String url = "https: String responseContent = this.mainService.get(url, null); JsonObject jsonObject = JSON_PARSER.parse(responseContent).getAsJsonObject(); if (jsonObject.get("errcode").getAsInt() != 0) { throw new WxErrorException(WxError.fromJson(responseContent)); } return WxCpGsonBuilder.create().fromJson(jsonObject.get("agentlist").toString(), new TypeToken<List<WxCpAgent>>() { }.getType()); } WxCpAgentServiceImpl(WxCpService mainService); }
WxCpAgentServiceImpl implements WxCpAgentService { @Override public List<WxCpAgent> list() throws WxErrorException { String url = "https: String responseContent = this.mainService.get(url, null); JsonObject jsonObject = JSON_PARSER.parse(responseContent).getAsJsonObject(); if (jsonObject.get("errcode").getAsInt() != 0) { throw new WxErrorException(WxError.fromJson(responseContent)); } return WxCpGsonBuilder.create().fromJson(jsonObject.get("agentlist").toString(), new TypeToken<List<WxCpAgent>>() { }.getType()); } WxCpAgentServiceImpl(WxCpService mainService); @Override WxCpAgent get(Integer agentId); @Override void set(WxCpAgent agentInfo); @Override List<WxCpAgent> list(); }
WxCpAgentServiceImpl implements WxCpAgentService { @Override public List<WxCpAgent> list() throws WxErrorException { String url = "https: String responseContent = this.mainService.get(url, null); JsonObject jsonObject = JSON_PARSER.parse(responseContent).getAsJsonObject(); if (jsonObject.get("errcode").getAsInt() != 0) { throw new WxErrorException(WxError.fromJson(responseContent)); } return WxCpGsonBuilder.create().fromJson(jsonObject.get("agentlist").toString(), new TypeToken<List<WxCpAgent>>() { }.getType()); } WxCpAgentServiceImpl(WxCpService mainService); @Override WxCpAgent get(Integer agentId); @Override void set(WxCpAgent agentInfo); @Override List<WxCpAgent> list();  }