@Test public void test_should_get_positions_by_id() { server.expect(once(), requestTo("http: .andExpect(method(HttpMethod.POST)) .andRespond(withSuccess(new Resources().getFileContents("positionResponse.json"), MediaType.APPLICATION_JSON_UTF8)); PositionResponse positionResponse = positionRepository.getById(1l,"tenantId"); server.verify(); assertEquals("position1", positionResponse.getName()); assertEquals(1, positionResponse.getId().intValue()); }
public PositionResponse getById(final Long id, final String tenantId) { RequestInfoWrapper wrapper = RequestInfoWrapper.builder().RequestInfo(RequestInfo.builder().build()).build(); final PositionServiceResponse positionServiceResponse = restTemplate.postForObject(positionsByIdUrl, wrapper, PositionServiceResponse.class, id, tenantId); return positionServiceResponse.getPositions().get(0); }
PositionRepository { public PositionResponse getById(final Long id, final String tenantId) { RequestInfoWrapper wrapper = RequestInfoWrapper.builder().RequestInfo(RequestInfo.builder().build()).build(); final PositionServiceResponse positionServiceResponse = restTemplate.postForObject(positionsByIdUrl, wrapper, PositionServiceResponse.class, id, tenantId); return positionServiceResponse.getPositions().get(0); } }
PositionRepository { public PositionResponse getById(final Long id, final String tenantId) { RequestInfoWrapper wrapper = RequestInfoWrapper.builder().RequestInfo(RequestInfo.builder().build()).build(); final PositionServiceResponse positionServiceResponse = restTemplate.postForObject(positionsByIdUrl, wrapper, PositionServiceResponse.class, id, tenantId); return positionServiceResponse.getPositions().get(0); } PositionRepository(final RestTemplate restTemplate,
                              @Value("${egov.services.hrmasters.host}") final String eisServiceHostname,
                              @Value("${egov.services.hr.position_by_id}") final String positionsByIdUrl); }
PositionRepository { public PositionResponse getById(final Long id, final String tenantId) { RequestInfoWrapper wrapper = RequestInfoWrapper.builder().RequestInfo(RequestInfo.builder().build()).build(); final PositionServiceResponse positionServiceResponse = restTemplate.postForObject(positionsByIdUrl, wrapper, PositionServiceResponse.class, id, tenantId); return positionServiceResponse.getPositions().get(0); } PositionRepository(final RestTemplate restTemplate,
                              @Value("${egov.services.hrmasters.host}") final String eisServiceHostname,
                              @Value("${egov.services.hr.position_by_id}") final String positionsByIdUrl); PositionResponse getById(final Long id, final String tenantId); }
PositionRepository { public PositionResponse getById(final Long id, final String tenantId) { RequestInfoWrapper wrapper = RequestInfoWrapper.builder().RequestInfo(RequestInfo.builder().build()).build(); final PositionServiceResponse positionServiceResponse = restTemplate.postForObject(positionsByIdUrl, wrapper, PositionServiceResponse.class, id, tenantId); return positionServiceResponse.getPositions().get(0); } PositionRepository(final RestTemplate restTemplate,
                              @Value("${egov.services.hrmasters.host}") final String eisServiceHostname,
                              @Value("${egov.services.hr.position_by_id}") final String positionsByIdUrl); PositionResponse getById(final Long id, final String tenantId);  }