WeatherService { public Iterable<Location> search(String query) { Iterable<LocationInfo> locals = api.search(query); return LazyQueries.map(locals, this::toLocation); } WeatherService(WeatherWebApi api);  WeatherService(); Iterable<Location> search(String query);  }
@Test public void testPastWeatherInOporto(){ Request req = new HttpRequest(); WeatherService service = new WeatherService(new WeatherWebApi(req)); Iterable<Location> locals = service.search("oporto"); Iterable<WeatherInfo> oportoWeather = skip(locals, 1).iterator().next().getPast30daysWeather(); int tempC = max(map(oportoWeather, WeatherInfo::getTempC)); Assert.assertEquals(22, tempC); }