WeatherService { @Cacheable("weather") public Weather getWeather(String country, String city) { logger.info("Requesting current weather for {}/{}", country, city); URI url = new UriTemplate(WEATHER_URL).expand(city, country, this.apiKey); return invoke(url, Weather.class); } WeatherService(RestTemplateBuilder restTemplateBuilder,
			WeatherAppProperties properties); @Cacheable("weather") Weather getWeather(String country, String city); @Cacheable("forecast") WeatherForecast getWeatherForecast(String country, String city);  }
@Test public void getWeather() { this.server.expect( requestTo(URL + "weather?q=barcelona,es&APPID=test-ABC")) .andRespond(withSuccess( new ClassPathResource("weather-barcelona.json", getClass()), MediaType.APPLICATION_JSON)); Weather forecast = this.weatherService.getWeather("es", "barcelona"); assertThat(forecast.getName()).isEqualTo("Barcelona"); assertThat(forecast.getTemperature()).isEqualTo(286.72, Offset.offset(0.1)); assertThat(forecast.getWeatherId()).isEqualTo(800); assertThat(forecast.getWeatherIcon()).isEqualTo("01d"); this.server.verify(); }