@Test public void weather() throws Exception { Weather weather = new Weather(); weather.setName("London"); setWeatherEntry(weather, 286.72, 800, "01d", Instant.ofEpochSecond(1234)); given(this.weatherService.getWeather("uk", "london")).willReturn(weather); this.mvc.perform(get("/api/weather/now/uk/london")) .andExpect(status().isOk()) .andExpect(jsonPath("$.name", is("London"))) .andExpect(jsonPath("$.temperature", is(286.72))) .andExpect(jsonPath("$.weatherId", is(800))) .andExpect(jsonPath("$.weatherIcon", is("01d"))) .andExpect(jsonPath("$.timestamp", is("1970-01-01T00:20:34Z"))); verify(this.weatherService).getWeather("uk", "london"); }
@RequestMapping("/now/{country}/{city}") public Weather getWeather(@PathVariable String country, @PathVariable String city) { return this.weatherService.getWeather(country, city); }
WeatherApiController { @RequestMapping("/now/{country}/{city}") public Weather getWeather(@PathVariable String country, @PathVariable String city) { return this.weatherService.getWeather(country, city); } }
WeatherApiController { @RequestMapping("/now/{country}/{city}") public Weather getWeather(@PathVariable String country, @PathVariable String city) { return this.weatherService.getWeather(country, city); } WeatherApiController(WeatherService weatherService); }
WeatherApiController { @RequestMapping("/now/{country}/{city}") public Weather getWeather(@PathVariable String country, @PathVariable String city) { return this.weatherService.getWeather(country, city); } WeatherApiController(WeatherService weatherService); @RequestMapping("/now/{country}/{city}") Weather getWeather(@PathVariable String country,
			@PathVariable String city); @RequestMapping("/weekly/{country}/{city}") WeatherForecast getWeatherForecast(@PathVariable String country,
			@PathVariable String city); }
WeatherApiController { @RequestMapping("/now/{country}/{city}") public Weather getWeather(@PathVariable String country, @PathVariable String city) { return this.weatherService.getWeather(country, city); } WeatherApiController(WeatherService weatherService); @RequestMapping("/now/{country}/{city}") Weather getWeather(@PathVariable String country,
			@PathVariable String city); @RequestMapping("/weekly/{country}/{city}") WeatherForecast getWeatherForecast(@PathVariable String country,
			@PathVariable String city);  }