@Test(dataProvider = "departIds") public void testList(Integer id) throws Exception { System.out.println("=================获取部门"); List<WxCpDepart> departList = this.wxCpService.getDepartmentService().list(id); assertThat(departList).isNotEmpty(); for (WxCpDepart g : departList) { this.depart = g; System.out.println(this.depart.getId() + ":" + this.depart.getName()); assertThat(g.getName()).isNotBlank(); } }
@Override public List<WxCpDepart> list(Integer id) throws WxErrorException { String url = "https: if (id != null) { url += "?id=" + id; } String responseContent = this.mainService.get(url, null); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); return WxCpGsonBuilder.INSTANCE.create() .fromJson(tmpJsonElement.getAsJsonObject().get("department"), new TypeToken<List<WxCpDepart>>() { }.getType() ); }
WxCpDepartmentServiceImpl implements WxCpDepartmentService { @Override public List<WxCpDepart> list(Integer id) throws WxErrorException { String url = "https: if (id != null) { url += "?id=" + id; } String responseContent = this.mainService.get(url, null); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); return WxCpGsonBuilder.INSTANCE.create() .fromJson(tmpJsonElement.getAsJsonObject().get("department"), new TypeToken<List<WxCpDepart>>() { }.getType() ); } }
WxCpDepartmentServiceImpl implements WxCpDepartmentService { @Override public List<WxCpDepart> list(Integer id) throws WxErrorException { String url = "https: if (id != null) { url += "?id=" + id; } String responseContent = this.mainService.get(url, null); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); return WxCpGsonBuilder.INSTANCE.create() .fromJson(tmpJsonElement.getAsJsonObject().get("department"), new TypeToken<List<WxCpDepart>>() { }.getType() ); } WxCpDepartmentServiceImpl(WxCpService mainService); }
WxCpDepartmentServiceImpl implements WxCpDepartmentService { @Override public List<WxCpDepart> list(Integer id) throws WxErrorException { String url = "https: if (id != null) { url += "?id=" + id; } String responseContent = this.mainService.get(url, null); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); return WxCpGsonBuilder.INSTANCE.create() .fromJson(tmpJsonElement.getAsJsonObject().get("department"), new TypeToken<List<WxCpDepart>>() { }.getType() ); } WxCpDepartmentServiceImpl(WxCpService mainService); @Override Integer create(WxCpDepart depart); @Override void update(WxCpDepart group); @Override void delete(Integer departId); @Override List<WxCpDepart> list(Integer id); }
WxCpDepartmentServiceImpl implements WxCpDepartmentService { @Override public List<WxCpDepart> list(Integer id) throws WxErrorException { String url = "https: if (id != null) { url += "?id=" + id; } String responseContent = this.mainService.get(url, null); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); return WxCpGsonBuilder.INSTANCE.create() .fromJson(tmpJsonElement.getAsJsonObject().get("department"), new TypeToken<List<WxCpDepart>>() { }.getType() ); } WxCpDepartmentServiceImpl(WxCpService mainService); @Override Integer create(WxCpDepart depart); @Override void update(WxCpDepart group); @Override void delete(Integer departId); @Override List<WxCpDepart> list(Integer id);  }