@Test public void test_should_fetch_city_for_given_id() throws Exception { server.expect(once(), requestTo("http: .andExpect(method(HttpMethod.POST)).andRespond(withSuccess( new Resources().getFileContents("successCityResponse.json"), MediaType.APPLICATION_JSON_UTF8)); final City city = cityRepository.fetchCityById(1L); server.verify(); assertEquals("Kurnool", city.getName()); assertEquals("KC", city.getCode()); }
public City fetchCityById(Long id) { String url = this.cityServiceHost + "v1/location/city/getCitybyCityRequest"; return getCityServiceResponse(url, id).getBody().getCity(); }
CityRepository { public City fetchCityById(Long id) { String url = this.cityServiceHost + "v1/location/city/getCitybyCityRequest"; return getCityServiceResponse(url, id).getBody().getCity(); } }
CityRepository { public City fetchCityById(Long id) { String url = this.cityServiceHost + "v1/location/city/getCitybyCityRequest"; return getCityServiceResponse(url, id).getBody().getCity(); } CityRepository(RestTemplate restTemplate, @Value("${egov.services.boundary.host}") String cityServiceHost); }
CityRepository { public City fetchCityById(Long id) { String url = this.cityServiceHost + "v1/location/city/getCitybyCityRequest"; return getCityServiceResponse(url, id).getBody().getCity(); } CityRepository(RestTemplate restTemplate, @Value("${egov.services.boundary.host}") String cityServiceHost); City fetchCityById(Long id); }
CityRepository { public City fetchCityById(Long id) { String url = this.cityServiceHost + "v1/location/city/getCitybyCityRequest"; return getCityServiceResponse(url, id).getBody().getCity(); } CityRepository(RestTemplate restTemplate, @Value("${egov.services.boundary.host}") String cityServiceHost); City fetchCityById(Long id);  }