@Test public void test_should_fetch_tenant_for_given_id() throws Exception { server.expect(once(), requestTo("http: .andExpect(method(HttpMethod.POST)) .andRespond(withSuccess(resources.getFileContents("successTenantResponse.json"), MediaType.APPLICATION_JSON_UTF8)); final Tenant tenant = tenantRepository.fetchTenantById("tenantId"); server.verify(); assertNotNull(tenant); assertEquals("cityname", tenant.getName()); }
public Tenant fetchTenantById(String tenantId) { final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().build()); TenantResponse tenantResponse = restTemplate .postForObject(tenantServiceUrl, requestInfoBody, TenantResponse.class, tenantId); return tenantResponse.toDomainTenant(); }
TenantRepository { public Tenant fetchTenantById(String tenantId) { final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().build()); TenantResponse tenantResponse = restTemplate .postForObject(tenantServiceUrl, requestInfoBody, TenantResponse.class, tenantId); return tenantResponse.toDomainTenant(); } }
TenantRepository { public Tenant fetchTenantById(String tenantId) { final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().build()); TenantResponse tenantResponse = restTemplate .postForObject(tenantServiceUrl, requestInfoBody, TenantResponse.class, tenantId); return tenantResponse.toDomainTenant(); } TenantRepository(RestTemplate restTemplate,
                            @Value("${tenant.host}") String tenantServiceHost,
                            @Value("${get.tenant.url}") String tenantServiceUrl
                            ); }
TenantRepository { public Tenant fetchTenantById(String tenantId) { final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().build()); TenantResponse tenantResponse = restTemplate .postForObject(tenantServiceUrl, requestInfoBody, TenantResponse.class, tenantId); return tenantResponse.toDomainTenant(); } TenantRepository(RestTemplate restTemplate,
                            @Value("${tenant.host}") String tenantServiceHost,
                            @Value("${get.tenant.url}") String tenantServiceUrl
                            ); Tenant fetchTenantById(String tenantId); }
TenantRepository { public Tenant fetchTenantById(String tenantId) { final RequestInfoBody requestInfoBody = new RequestInfoBody(RequestInfo.builder().build()); TenantResponse tenantResponse = restTemplate .postForObject(tenantServiceUrl, requestInfoBody, TenantResponse.class, tenantId); return tenantResponse.toDomainTenant(); } TenantRepository(RestTemplate restTemplate,
                            @Value("${tenant.host}") String tenantServiceHost,
                            @Value("${get.tenant.url}") String tenantServiceUrl
                            ); Tenant fetchTenantById(String tenantId);  }