@Test public void test_should_get_complaint_type_id_for_given_complaint_code() { server.expect(once(), requestTo("http: .andExpect(method(HttpMethod.POST)) .andRespond(withSuccess(resources.getFileContents("complaintTypeResponse.json"), MediaType.APPLICATION_JSON_UTF8)); final String complaintTypeId = complaintTypeRepository .getComplaintTypeId("complaintTypeCode", "tenantId"); server.verify(); assertEquals("5", complaintTypeId); }
public String getComplaintTypeId(String complaintTypeCode, String tenantId) { final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().build()); final HttpEntity<RequestInfoBody> request = new HttpEntity<>(requestInfoBody); return String.valueOf(restTemplate.postForObject(url, request, ComplaintTypeServiceResponse.class, complaintTypeCode, tenantId).getComplaintTypes().get(0).getId()); }
ComplaintTypeRepository { public String getComplaintTypeId(String complaintTypeCode, String tenantId) { final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().build()); final HttpEntity<RequestInfoBody> request = new HttpEntity<>(requestInfoBody); return String.valueOf(restTemplate.postForObject(url, request, ComplaintTypeServiceResponse.class, complaintTypeCode, tenantId).getComplaintTypes().get(0).getId()); } }
ComplaintTypeRepository { public String getComplaintTypeId(String complaintTypeCode, String tenantId) { final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().build()); final HttpEntity<RequestInfoBody> request = new HttpEntity<>(requestInfoBody); return String.valueOf(restTemplate.postForObject(url, request, ComplaintTypeServiceResponse.class, complaintTypeCode, tenantId).getComplaintTypes().get(0).getId()); } ComplaintTypeRepository(RestTemplate restTemplate,
                                   @Value("${egov.services.pgr.host}") String pgrRestHost,
                                   @Value("${egov.services.pgr.complainttype}") String complaintTypeUrl); }
ComplaintTypeRepository { public String getComplaintTypeId(String complaintTypeCode, String tenantId) { final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().build()); final HttpEntity<RequestInfoBody> request = new HttpEntity<>(requestInfoBody); return String.valueOf(restTemplate.postForObject(url, request, ComplaintTypeServiceResponse.class, complaintTypeCode, tenantId).getComplaintTypes().get(0).getId()); } ComplaintTypeRepository(RestTemplate restTemplate,
                                   @Value("${egov.services.pgr.host}") String pgrRestHost,
                                   @Value("${egov.services.pgr.complainttype}") String complaintTypeUrl); String getComplaintTypeId(String complaintTypeCode, String tenantId); }
ComplaintTypeRepository { public String getComplaintTypeId(String complaintTypeCode, String tenantId) { final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().build()); final HttpEntity<RequestInfoBody> request = new HttpEntity<>(requestInfoBody); return String.valueOf(restTemplate.postForObject(url, request, ComplaintTypeServiceResponse.class, complaintTypeCode, tenantId).getComplaintTypes().get(0).getId()); } ComplaintTypeRepository(RestTemplate restTemplate,
                                   @Value("${egov.services.pgr.host}") String pgrRestHost,
                                   @Value("${egov.services.pgr.complainttype}") String complaintTypeUrl); String getComplaintTypeId(String complaintTypeCode, String tenantId);  }