@Test public void testGetBoundary() { ResponseInfo responseInfo = new ResponseInfo("emp", "1.0", "2017-01-18T07:18:23.130Z", "uief87324", "20170310130900", "200"); Boundary boundary = Boundary.builder().id("10").name("employee").tenantId("default").build(); BoundaryResponse boundaryResponse = BoundaryResponse.builder().responseInfo(responseInfo) .boundarys(Collections.singletonList(boundary)).build(); when(propertiesManager.getEgovLocationServiceHost()).thenReturn("http: when(propertiesManager.getEgovLocationServiceBasepath()).thenReturn("/egov-location"); when(propertiesManager.getEgovLocationServiceBoundarySearchPath()).thenReturn("/boundarys"); RequestInfoWrapper requestInfoWrapper = new RequestInfoWrapper(); URI uri = null; try { uri = new URI("http: } catch (URISyntaxException e) { e.printStackTrace(); } when(restTemplate.getForObject(uri, BoundaryResponse.class)).thenReturn(boundaryResponse); Boundary insertedBoundary = boundaryService.getBoundary(10L, "default"); assertEquals(insertedBoundary, boundary); }
public Boundary getBoundary(Long id, String tenantId) { BoundaryResponse boundaryResponse; try { URI url = new URI(propertiesManager.getEgovLocationServiceHost() + propertiesManager.getEgovLocationServiceBasepath() + propertiesManager.getEgovLocationServiceBoundarySearchPath() + "?Boundary.tenantId=" + tenantId + "&Boundary.id=" + id); log.info(url.toString()); boundaryResponse = restTemplate.getForObject(url, BoundaryResponse.class); } catch (Exception e) { e.printStackTrace(); return null; } return isEmpty(boundaryResponse.getBoundarys()) ? null : boundaryResponse.getBoundarys().get(0); }
BoundaryService { public Boundary getBoundary(Long id, String tenantId) { BoundaryResponse boundaryResponse; try { URI url = new URI(propertiesManager.getEgovLocationServiceHost() + propertiesManager.getEgovLocationServiceBasepath() + propertiesManager.getEgovLocationServiceBoundarySearchPath() + "?Boundary.tenantId=" + tenantId + "&Boundary.id=" + id); log.info(url.toString()); boundaryResponse = restTemplate.getForObject(url, BoundaryResponse.class); } catch (Exception e) { e.printStackTrace(); return null; } return isEmpty(boundaryResponse.getBoundarys()) ? null : boundaryResponse.getBoundarys().get(0); } }
BoundaryService { public Boundary getBoundary(Long id, String tenantId) { BoundaryResponse boundaryResponse; try { URI url = new URI(propertiesManager.getEgovLocationServiceHost() + propertiesManager.getEgovLocationServiceBasepath() + propertiesManager.getEgovLocationServiceBoundarySearchPath() + "?Boundary.tenantId=" + tenantId + "&Boundary.id=" + id); log.info(url.toString()); boundaryResponse = restTemplate.getForObject(url, BoundaryResponse.class); } catch (Exception e) { e.printStackTrace(); return null; } return isEmpty(boundaryResponse.getBoundarys()) ? null : boundaryResponse.getBoundarys().get(0); }  }
BoundaryService { public Boundary getBoundary(Long id, String tenantId) { BoundaryResponse boundaryResponse; try { URI url = new URI(propertiesManager.getEgovLocationServiceHost() + propertiesManager.getEgovLocationServiceBasepath() + propertiesManager.getEgovLocationServiceBoundarySearchPath() + "?Boundary.tenantId=" + tenantId + "&Boundary.id=" + id); log.info(url.toString()); boundaryResponse = restTemplate.getForObject(url, BoundaryResponse.class); } catch (Exception e) { e.printStackTrace(); return null; } return isEmpty(boundaryResponse.getBoundarys()) ? null : boundaryResponse.getBoundarys().get(0); }  Boundary getBoundary(Long id, String tenantId); }
BoundaryService { public Boundary getBoundary(Long id, String tenantId) { BoundaryResponse boundaryResponse; try { URI url = new URI(propertiesManager.getEgovLocationServiceHost() + propertiesManager.getEgovLocationServiceBasepath() + propertiesManager.getEgovLocationServiceBoundarySearchPath() + "?Boundary.tenantId=" + tenantId + "&Boundary.id=" + id); log.info(url.toString()); boundaryResponse = restTemplate.getForObject(url, BoundaryResponse.class); } catch (Exception e) { e.printStackTrace(); return null; } return isEmpty(boundaryResponse.getBoundarys()) ? null : boundaryResponse.getBoundarys().get(0); }  Boundary getBoundary(Long id, String tenantId);  }