@Test
public void testPastWeatherInOporto(){

    // CountableRequest req = new CountableRequest(new HttpRequest());
    Request r = new HttpRequest();
    int[] count = {0};
    Function<String, String> counter = path -> {
        count[0]++;
        System.out.println("Request " + path);
        return path;
    };
    Function<String, Iterable<String>> req = counter.andThen(r::getLines);
    WeatherService service = new WeatherService(new WeatherRestfullApi(req::apply));
    Iterable<Location> locals = service.search("oporto");
    assertEquals(1, count[0]);
    Iterable<WeatherInfo> oportoWeather = first(skip(locals, 1)).getPast30daysWeather();
    int tempC = max(map(oportoWeather, WeatherInfo::getTempC));
    assertEquals(22, tempC);
    assertEquals(2, count[0]);
    count(locals); // + 6 requests of pastWeather for 6 locations
    assertEquals(2, count[0]);
}