@Test public void testGetEmployeeType() { ResponseInfo responseInfo = new ResponseInfo("emp", "1.0", "2017-01-18T07:18:23.130Z", "uief87324", "20170310130900", "200"); EmployeeType employeeType = new EmployeeType().builder().id(100L).name("employee1").chartOfAccounts("employed") .tenantId("1").build(); List<EmployeeType> employeeTypes = new ArrayList<>(); employeeTypes.add(employeeType); EmployeeTypeResponse employeeTypeResponse = new EmployeeTypeResponse().builder().responseInfo(responseInfo) .employeeType(employeeTypes).build(); when(propertiesManager.getHrMastersServiceHost()).thenReturn("http: when(propertiesManager.getHrMastersServiceBasepath()).thenReturn("/hr-masters"); when(propertiesManager.getHrMastersServiceEmployeeTypeSearchPath()).thenReturn("/employeetypes/_search"); RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); URI uri = null; try { uri = new URI("http: } catch (URISyntaxException e) { e.printStackTrace(); } when(restTemplate.postForObject(uri, getRequestInfoAsHttpEntity(requestInfoWrapper), EmployeeTypeResponse.class)).thenReturn(employeeTypeResponse); EmployeeType insertedEmployeeType = hrMasterService.getEmployeeType(100L, "1", new RequestInfoWrapper()); assertEquals(insertedEmployeeType, employeeType); }
public EmployeeType getEmployeeType(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper) { URI url = null; EmployeeTypeResponse employeeTypeResponse = null; try { url = new URI(propertiesManager.getHrMastersServiceHost() + propertiesManager.getHrMastersServiceBasepath() + propertiesManager.getHrMastersServiceEmployeeTypeSearchPath() + "?id=" + id + "&tenantId=" + tenantId); LOGGER.debug(url.toString()); try { employeeTypeResponse = restTemplate.postForObject(url, getRequestInfoAsHttpEntity(requestInfoWrapper), EmployeeTypeResponse.class); } catch (HttpClientErrorException e) { String errorResponseBody = e.getResponseBodyAsString(); LOGGER.error(errorResponseBody); } } catch (Exception e) { e.printStackTrace(); LOGGER.error("Following exception occurred while generating URI : " + e.getMessage()); return null; } return employeeTypeResponse.getEmployeeType().get(0); }
HRMasterService { public EmployeeType getEmployeeType(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper) { URI url = null; EmployeeTypeResponse employeeTypeResponse = null; try { url = new URI(propertiesManager.getHrMastersServiceHost() + propertiesManager.getHrMastersServiceBasepath() + propertiesManager.getHrMastersServiceEmployeeTypeSearchPath() + "?id=" + id + "&tenantId=" + tenantId); LOGGER.debug(url.toString()); try { employeeTypeResponse = restTemplate.postForObject(url, getRequestInfoAsHttpEntity(requestInfoWrapper), EmployeeTypeResponse.class); } catch (HttpClientErrorException e) { String errorResponseBody = e.getResponseBodyAsString(); LOGGER.error(errorResponseBody); } } catch (Exception e) { e.printStackTrace(); LOGGER.error("Following exception occurred while generating URI : " + e.getMessage()); return null; } return employeeTypeResponse.getEmployeeType().get(0); } }
HRMasterService { public EmployeeType getEmployeeType(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper) { URI url = null; EmployeeTypeResponse employeeTypeResponse = null; try { url = new URI(propertiesManager.getHrMastersServiceHost() + propertiesManager.getHrMastersServiceBasepath() + propertiesManager.getHrMastersServiceEmployeeTypeSearchPath() + "?id=" + id + "&tenantId=" + tenantId); LOGGER.debug(url.toString()); try { employeeTypeResponse = restTemplate.postForObject(url, getRequestInfoAsHttpEntity(requestInfoWrapper), EmployeeTypeResponse.class); } catch (HttpClientErrorException e) { String errorResponseBody = e.getResponseBodyAsString(); LOGGER.error(errorResponseBody); } } catch (Exception e) { e.printStackTrace(); LOGGER.error("Following exception occurred while generating URI : " + e.getMessage()); return null; } return employeeTypeResponse.getEmployeeType().get(0); }  }
HRMasterService { public EmployeeType getEmployeeType(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper) { URI url = null; EmployeeTypeResponse employeeTypeResponse = null; try { url = new URI(propertiesManager.getHrMastersServiceHost() + propertiesManager.getHrMastersServiceBasepath() + propertiesManager.getHrMastersServiceEmployeeTypeSearchPath() + "?id=" + id + "&tenantId=" + tenantId); LOGGER.debug(url.toString()); try { employeeTypeResponse = restTemplate.postForObject(url, getRequestInfoAsHttpEntity(requestInfoWrapper), EmployeeTypeResponse.class); } catch (HttpClientErrorException e) { String errorResponseBody = e.getResponseBodyAsString(); LOGGER.error(errorResponseBody); } } catch (Exception e) { e.printStackTrace(); LOGGER.error("Following exception occurred while generating URI : " + e.getMessage()); return null; } return employeeTypeResponse.getEmployeeType().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 EmployeeType getEmployeeType(Long id, String tenantId, RequestInfoWrapper requestInfoWrapper) { URI url = null; EmployeeTypeResponse employeeTypeResponse = null; try { url = new URI(propertiesManager.getHrMastersServiceHost() + propertiesManager.getHrMastersServiceBasepath() + propertiesManager.getHrMastersServiceEmployeeTypeSearchPath() + "?id=" + id + "&tenantId=" + tenantId); LOGGER.debug(url.toString()); try { employeeTypeResponse = restTemplate.postForObject(url, getRequestInfoAsHttpEntity(requestInfoWrapper), EmployeeTypeResponse.class); } catch (HttpClientErrorException e) { String errorResponseBody = e.getResponseBodyAsString(); LOGGER.error(errorResponseBody); } } catch (Exception e) { e.printStackTrace(); LOGGER.error("Following exception occurred while generating URI : " + e.getMessage()); return null; } return employeeTypeResponse.getEmployeeType().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; }