@Test public void testShouldGetComplaintByCrnNo() { server.expect(once(), requestTo("http: .andExpect(method(HttpMethod.POST)) .andRespond(withSuccess(new Resources().getFileContents("complaintSearchResponse.json"), MediaType.APPLICATION_JSON_UTF8)); final ServiceRequest sevaRequest = complaintRestRepositoryRepository.getComplaintByCrn("ap.public", "00015-2016-AP"); server.verify(); assertTrue(sevaRequest != null); }
public ServiceRequest getComplaintByCrn(final String tenantId, final String serviceRequestId) { final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().build()); final HttpEntity<RequestInfoBody> request = new HttpEntity<>(requestInfoBody); return restTemplate.postForObject(url, request, ComplaintResponse.class, tenantId, serviceRequestId).getServiceRequests().get(0); }
ComplaintRestRepository { public ServiceRequest getComplaintByCrn(final String tenantId, final String serviceRequestId) { final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().build()); final HttpEntity<RequestInfoBody> request = new HttpEntity<>(requestInfoBody); return restTemplate.postForObject(url, request, ComplaintResponse.class, tenantId, serviceRequestId).getServiceRequests().get(0); } }
ComplaintRestRepository { public ServiceRequest getComplaintByCrn(final String tenantId, final String serviceRequestId) { final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().build()); final HttpEntity<RequestInfoBody> request = new HttpEntity<>(requestInfoBody); return restTemplate.postForObject(url, request, ComplaintResponse.class, tenantId, serviceRequestId).getServiceRequests().get(0); } ComplaintRestRepository(final RestTemplate restTemplate,
                                   @Value("${egov.services.pgr.host}") final String pgrRestHost,
                                   @Value("${egov.services.pgr.complaint_crn}") final String url); }
ComplaintRestRepository { public ServiceRequest getComplaintByCrn(final String tenantId, final String serviceRequestId) { final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().build()); final HttpEntity<RequestInfoBody> request = new HttpEntity<>(requestInfoBody); return restTemplate.postForObject(url, request, ComplaintResponse.class, tenantId, serviceRequestId).getServiceRequests().get(0); } ComplaintRestRepository(final RestTemplate restTemplate,
                                   @Value("${egov.services.pgr.host}") final String pgrRestHost,
                                   @Value("${egov.services.pgr.complaint_crn}") final String url); ServiceRequest getComplaintByCrn(final String tenantId, final String serviceRequestId); }
ComplaintRestRepository { public ServiceRequest getComplaintByCrn(final String tenantId, final String serviceRequestId) { final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().build()); final HttpEntity<RequestInfoBody> request = new HttpEntity<>(requestInfoBody); return restTemplate.postForObject(url, request, ComplaintResponse.class, tenantId, serviceRequestId).getServiceRequests().get(0); } ComplaintRestRepository(final RestTemplate restTemplate,
                                   @Value("${egov.services.pgr.host}") final String pgrRestHost,
                                   @Value("${egov.services.pgr.complaint_crn}") final String url); ServiceRequest getComplaintByCrn(final String tenantId, final String serviceRequestId);  }