CtripOrganizationService implements Organization { @Override public List<OrganizationModel> retrieveOrganizationInfo() { try { String accessToken = config.getCmsAccessToken(); String url = config.getCmsOrganizationUrl(); AccessBody accessBody = new AccessBody(); accessBody.setAccess_token(accessToken); OrgResponseBody response = restTemplate.postForObject(url, accessBody, OrgResponseBody.class); if (!response.isStatus()) { logger.error("Could not get rest response from CMS system"); logger.debug("{}", response); } List<OrganizationModel> orgs = response.getData().stream().map(org -> { OrganizationModel organizationModel = new OrganizationModel(); organizationModel.setId(org.getOrganizationId()); organizationModel.setName(org.getName()); return organizationModel; }).sorted(new OrgIdComparator()).collect(Collectors.toList()); return orgs; } catch (Exception e) { logger.error(e.getMessage()); return null; } }  @Override List<OrganizationModel> retrieveOrganizationInfo(); @Override int getOrder();  }
@Test public void testRetrieveOrganizationInfo() throws Exception { List<OrganizationModel> organizationModelList = organization.retrieveOrganizationInfo(); Assert.assertNotNull(organizationModelList); Assert.assertNotEquals(0, organizationModelList.size()); }