@Test public void testGetGroup() { ResponseInfo responseInfo = new ResponseInfo("emp", "1.0", "2017-01-18T07:18:23.130Z", "uief87324", "20170310130900", "200"); Group group = new Group().builder().id(10L).name("b").description("b").tenantId("1").build(); List<Group> groups = new ArrayList<>(); groups.add(group); GroupResponse groupResponse = new GroupResponse().builder().responseInfo(responseInfo).group(groups).build(); when(propertiesManager.getHrMastersServiceHost()).thenReturn("http: when(propertiesManager.getHrMastersServiceBasepath()).thenReturn("/hr-masters"); when(propertiesManager.getHrMastersServiceGroupSearchPath()).thenReturn("/groups/_search"); RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); URI uri = null; try { uri = new URI("http: } catch (URISyntaxException e) { e.printStackTrace(); } when(restTemplate.postForObject(uri, getRequestInfoAsHttpEntity(requestInfoWrapper), GroupResponse.class)) .thenReturn(groupResponse); Group insertedGroup = hrMasterService.getGroup(100L, "1", new RequestInfoWrapper()); assertEquals(insertedGroup, group); }
public Group getGroup(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper) { URI url = null; GroupResponse groupResponse = null; try { url = new URI(propertiesManager.getHrMastersServiceHost() + propertiesManager.getHrMastersServiceBasepath() + propertiesManager.getHrMastersServiceGroupSearchPath() + "?id=" + id + "&tenantId=" + tenantId); LOGGER.info(url.toString()); groupResponse = restTemplate.postForObject(url, getRequestInfoAsHttpEntity(requestInfoWrapper), GroupResponse.class); } catch (Exception e) { e.printStackTrace(); LOGGER.error("Following exception occurred while generating URI : " + e.getMessage()); return null; } return groupResponse.getGroup().get(0); }
HRMasterService { public Group getGroup(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper) { URI url = null; GroupResponse groupResponse = null; try { url = new URI(propertiesManager.getHrMastersServiceHost() + propertiesManager.getHrMastersServiceBasepath() + propertiesManager.getHrMastersServiceGroupSearchPath() + "?id=" + id + "&tenantId=" + tenantId); LOGGER.info(url.toString()); groupResponse = restTemplate.postForObject(url, getRequestInfoAsHttpEntity(requestInfoWrapper), GroupResponse.class); } catch (Exception e) { e.printStackTrace(); LOGGER.error("Following exception occurred while generating URI : " + e.getMessage()); return null; } return groupResponse.getGroup().get(0); } }
HRMasterService { public Group getGroup(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper) { URI url = null; GroupResponse groupResponse = null; try { url = new URI(propertiesManager.getHrMastersServiceHost() + propertiesManager.getHrMastersServiceBasepath() + propertiesManager.getHrMastersServiceGroupSearchPath() + "?id=" + id + "&tenantId=" + tenantId); LOGGER.info(url.toString()); groupResponse = restTemplate.postForObject(url, getRequestInfoAsHttpEntity(requestInfoWrapper), GroupResponse.class); } catch (Exception e) { e.printStackTrace(); LOGGER.error("Following exception occurred while generating URI : " + e.getMessage()); return null; } return groupResponse.getGroup().get(0); }  }
HRMasterService { public Group getGroup(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper) { URI url = null; GroupResponse groupResponse = null; try { url = new URI(propertiesManager.getHrMastersServiceHost() + propertiesManager.getHrMastersServiceBasepath() + propertiesManager.getHrMastersServiceGroupSearchPath() + "?id=" + id + "&tenantId=" + tenantId); LOGGER.info(url.toString()); groupResponse = restTemplate.postForObject(url, getRequestInfoAsHttpEntity(requestInfoWrapper), GroupResponse.class); } catch (Exception e) { e.printStackTrace(); LOGGER.error("Following exception occurred while generating URI : " + e.getMessage()); return null; } return groupResponse.getGroup().get(0); }  EmployeeType getEmployeeType(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper); RecruitmentMode getRecruitmentMode(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper); RecruitmentQuota getRecruitmentQuota(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper); RecruitmentType getRecruitmentType(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper); Grade getGrade(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper); Group getGroup(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper); Position getPosition(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper); Designation getDesignation(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper); HRStatus getEmployeeStatus(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper); }
HRMasterService { public Group getGroup(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper) { URI url = null; GroupResponse groupResponse = null; try { url = new URI(propertiesManager.getHrMastersServiceHost() + propertiesManager.getHrMastersServiceBasepath() + propertiesManager.getHrMastersServiceGroupSearchPath() + "?id=" + id + "&tenantId=" + tenantId); LOGGER.info(url.toString()); groupResponse = restTemplate.postForObject(url, getRequestInfoAsHttpEntity(requestInfoWrapper), GroupResponse.class); } catch (Exception e) { e.printStackTrace(); LOGGER.error("Following exception occurred while generating URI : " + e.getMessage()); return null; } return groupResponse.getGroup().get(0); }  EmployeeType getEmployeeType(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper); RecruitmentMode getRecruitmentMode(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper); RecruitmentQuota getRecruitmentQuota(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper); RecruitmentType getRecruitmentType(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper); Grade getGrade(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper); Group getGroup(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper); Position getPosition(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper); Designation getDesignation(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper); HRStatus getEmployeeStatus(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper); static final Logger LOGGER; }