@Test public void test_to_return_all_tenants(){ String expectedUrl = "http: server.expect(once(), requestTo(expectedUrl)).andExpect(method(HttpMethod.POST)) .andRespond(withSuccess(resources.getFileContents("tenantResponse.json"), MediaType.APPLICATION_JSON_UTF8)); SearchTenantResponse response = tenantRepository.getAllTenants(); server.verify(); assertEquals( "default", response.getTenant().get(0).getCode()); }
public SearchTenantResponse getAllTenants() { RequestInfoWrapper wrapper = RequestInfoWrapper.builder().requestInfo(RequestInfo.builder().apiId("apiId").ver("ver").ts(new Date()).build()).build(); final HttpEntity<RequestInfoWrapper> request = new HttpEntity<>(wrapper); return restTemplate.postForObject(this.url, request,SearchTenantResponse.class); }
TenantRepository { public SearchTenantResponse getAllTenants() { RequestInfoWrapper wrapper = RequestInfoWrapper.builder().requestInfo(RequestInfo.builder().apiId("apiId").ver("ver").ts(new Date()).build()).build(); final HttpEntity<RequestInfoWrapper> request = new HttpEntity<>(wrapper); return restTemplate.postForObject(this.url, request,SearchTenantResponse.class); } }
TenantRepository { public SearchTenantResponse getAllTenants() { RequestInfoWrapper wrapper = RequestInfoWrapper.builder().requestInfo(RequestInfo.builder().apiId("apiId").ver("ver").ts(new Date()).build()).build(); final HttpEntity<RequestInfoWrapper> request = new HttpEntity<>(wrapper); return restTemplate.postForObject(this.url, request,SearchTenantResponse.class); } TenantRepository(RestTemplate restTemplate,
                            @Value("${egov.services.tenant.host}") String host,
                            @Value("${egov.services.tenant.search}") String endpointUrl); }
TenantRepository { public SearchTenantResponse getAllTenants() { RequestInfoWrapper wrapper = RequestInfoWrapper.builder().requestInfo(RequestInfo.builder().apiId("apiId").ver("ver").ts(new Date()).build()).build(); final HttpEntity<RequestInfoWrapper> request = new HttpEntity<>(wrapper); return restTemplate.postForObject(this.url, request,SearchTenantResponse.class); } TenantRepository(RestTemplate restTemplate,
                            @Value("${egov.services.tenant.host}") String host,
                            @Value("${egov.services.tenant.search}") String endpointUrl); SearchTenantResponse getAllTenants(); }
TenantRepository { public SearchTenantResponse getAllTenants() { RequestInfoWrapper wrapper = RequestInfoWrapper.builder().requestInfo(RequestInfo.builder().apiId("apiId").ver("ver").ts(new Date()).build()).build(); final HttpEntity<RequestInfoWrapper> request = new HttpEntity<>(wrapper); return restTemplate.postForObject(this.url, request,SearchTenantResponse.class); } TenantRepository(RestTemplate restTemplate,
                            @Value("${egov.services.tenant.host}") String host,
                            @Value("${egov.services.tenant.search}") String endpointUrl); SearchTenantResponse getAllTenants();  }