@Test public void test_should_fetch_hierarchy_for_given_id() { server.expect(once(), requestTo("http: .andExpect(method(HttpMethod.POST)) .andRespond( withSuccess(new Resources().getFileContents("successHierarchyResponse.json"), MediaType.APPLICATION_JSON_UTF8)); final CrossHierarchyResponse response = crossHierarchyRepository.getCrossHierarchy("5", "tenantId"); server.verify(); assertEquals("1", response.getLocationId()); assertEquals("parent", response.getLocationName()); assertEquals("2", response.getChildLocationId()); }
public CrossHierarchyResponse getCrossHierarchy(String crossHierarchyId, String tenantId) { CrossHierarchySearchRequest crossHierarchySearchRequest = getCrossHierarchySearchRequest(crossHierarchyId, tenantId); CrossHierarchyServiceResponse crossHierarchyServiceResponse = restTemplate.postForObject(url, crossHierarchySearchRequest, CrossHierarchyServiceResponse.class); return crossHierarchyServiceResponse.getCrossHierarchy(); }
CrossHierarchyRepository { public CrossHierarchyResponse getCrossHierarchy(String crossHierarchyId, String tenantId) { CrossHierarchySearchRequest crossHierarchySearchRequest = getCrossHierarchySearchRequest(crossHierarchyId, tenantId); CrossHierarchyServiceResponse crossHierarchyServiceResponse = restTemplate.postForObject(url, crossHierarchySearchRequest, CrossHierarchyServiceResponse.class); return crossHierarchyServiceResponse.getCrossHierarchy(); } }
CrossHierarchyRepository { public CrossHierarchyResponse getCrossHierarchy(String crossHierarchyId, String tenantId) { CrossHierarchySearchRequest crossHierarchySearchRequest = getCrossHierarchySearchRequest(crossHierarchyId, tenantId); CrossHierarchyServiceResponse crossHierarchyServiceResponse = restTemplate.postForObject(url, crossHierarchySearchRequest, CrossHierarchyServiceResponse.class); return crossHierarchyServiceResponse.getCrossHierarchy(); } CrossHierarchyRepository(@Value("${egov.services.boundary.host}")
                                        String crossHierarchyServiceHost,
                                    @Value("${egov.services.boundary.context.fetch_by_hierarchy_id}")
                                        String crossHierarchyUrl,
                                    RestTemplate restTemplate); }
CrossHierarchyRepository { public CrossHierarchyResponse getCrossHierarchy(String crossHierarchyId, String tenantId) { CrossHierarchySearchRequest crossHierarchySearchRequest = getCrossHierarchySearchRequest(crossHierarchyId, tenantId); CrossHierarchyServiceResponse crossHierarchyServiceResponse = restTemplate.postForObject(url, crossHierarchySearchRequest, CrossHierarchyServiceResponse.class); return crossHierarchyServiceResponse.getCrossHierarchy(); } CrossHierarchyRepository(@Value("${egov.services.boundary.host}")
                                        String crossHierarchyServiceHost,
                                    @Value("${egov.services.boundary.context.fetch_by_hierarchy_id}")
                                        String crossHierarchyUrl,
                                    RestTemplate restTemplate); CrossHierarchyResponse getCrossHierarchy(String crossHierarchyId, String tenantId); }
CrossHierarchyRepository { public CrossHierarchyResponse getCrossHierarchy(String crossHierarchyId, String tenantId) { CrossHierarchySearchRequest crossHierarchySearchRequest = getCrossHierarchySearchRequest(crossHierarchyId, tenantId); CrossHierarchyServiceResponse crossHierarchyServiceResponse = restTemplate.postForObject(url, crossHierarchySearchRequest, CrossHierarchyServiceResponse.class); return crossHierarchyServiceResponse.getCrossHierarchy(); } CrossHierarchyRepository(@Value("${egov.services.boundary.host}")
                                        String crossHierarchyServiceHost,
                                    @Value("${egov.services.boundary.context.fetch_by_hierarchy_id}")
                                        String crossHierarchyUrl,
                                    RestTemplate restTemplate); CrossHierarchyResponse getCrossHierarchy(String crossHierarchyId, String tenantId);  }