@Test public void test_should_get_complainttype_by_code() { server.expect(once(), requestTo("http: .andExpect(method(HttpMethod.POST)) .andRespond(withSuccess(new Resources().getFileContents("complaintTypeResponse.json"), MediaType.APPLICATION_JSON_UTF8)); final ComplaintTypeResponse complaintResponseExpected = complaintTypeRepository.fetchComplaintTypeByCode("C001","ap.public"); server.verify(); assertEquals(2, complaintResponseExpected.getId().intValue()); assertEquals("C001", complaintResponseExpected.getServiceCode()); }
public ComplaintTypeResponse fetchComplaintTypeByCode(final String code, final String tenantId) { final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().build()); final HttpEntity<RequestInfoBody> request = new HttpEntity<>(requestInfoBody); return restTemplate.postForObject(url, request, ComplaintTypeServiceResponse.class, code, tenantId).getComplaintTypes().get(0); }
ComplaintTypeRepository { public ComplaintTypeResponse fetchComplaintTypeByCode(final String code, final String tenantId) { final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().build()); final HttpEntity<RequestInfoBody> request = new HttpEntity<>(requestInfoBody); return restTemplate.postForObject(url, request, ComplaintTypeServiceResponse.class, code, tenantId).getComplaintTypes().get(0); } }
ComplaintTypeRepository { public ComplaintTypeResponse fetchComplaintTypeByCode(final String code, final String tenantId) { final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().build()); final HttpEntity<RequestInfoBody> request = new HttpEntity<>(requestInfoBody); return restTemplate.postForObject(url, request, ComplaintTypeServiceResponse.class, code, tenantId).getComplaintTypes().get(0); } ComplaintTypeRepository(final RestTemplate restTemplate,
            @Value("${egov.services.pgrrest.host}") final String complaintTypeServiceHost,
            @Value("${egov.services.pgr.complainttypes_by_code}") final String url); }
ComplaintTypeRepository { public ComplaintTypeResponse fetchComplaintTypeByCode(final String code, final String tenantId) { final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().build()); final HttpEntity<RequestInfoBody> request = new HttpEntity<>(requestInfoBody); return restTemplate.postForObject(url, request, ComplaintTypeServiceResponse.class, code, tenantId).getComplaintTypes().get(0); } ComplaintTypeRepository(final RestTemplate restTemplate,
            @Value("${egov.services.pgrrest.host}") final String complaintTypeServiceHost,
            @Value("${egov.services.pgr.complainttypes_by_code}") final String url); ComplaintTypeResponse fetchComplaintTypeByCode(final String code, final String tenantId); }
ComplaintTypeRepository { public ComplaintTypeResponse fetchComplaintTypeByCode(final String code, final String tenantId) { final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().build()); final HttpEntity<RequestInfoBody> request = new HttpEntity<>(requestInfoBody); return restTemplate.postForObject(url, request, ComplaintTypeServiceResponse.class, code, tenantId).getComplaintTypes().get(0); } ComplaintTypeRepository(final RestTemplate restTemplate,
            @Value("${egov.services.pgrrest.host}") final String complaintTypeServiceHost,
            @Value("${egov.services.pgr.complainttypes_by_code}") final String url); ComplaintTypeResponse fetchComplaintTypeByCode(final String code, final String tenantId);  }