@Test void pastWeather() { }
public List<WeatherInfo> pastWeather(double lat, double log, LocalDate from, LocalDate to) { String path = HOST + String.format(PATH_PAST_WEATHER, lat, log, from, to, WEATHER_KEY); List<WeatherInfo> infos = new ArrayList<>(); try( InputStream in = new URL(path).openStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(in))) { String line; while (reader.readLine().startsWith("#")) { } reader.readLine(); while ((line = reader.readLine()) != null) { infos.add(WeatherInfo.valueOf(line)); reader.readLine(); } } catch (IOException e) { throw new RuntimeException(e); } return infos; }
WeatherWebApi { public List<WeatherInfo> pastWeather(double lat, double log, LocalDate from, LocalDate to) { String path = HOST + String.format(PATH_PAST_WEATHER, lat, log, from, to, WEATHER_KEY); List<WeatherInfo> infos = new ArrayList<>(); try( InputStream in = new URL(path).openStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(in))) { String line; while (reader.readLine().startsWith("#")) { } reader.readLine(); while ((line = reader.readLine()) != null) { infos.add(WeatherInfo.valueOf(line)); reader.readLine(); } } catch (IOException e) { throw new RuntimeException(e); } return infos; } }
WeatherWebApi { public List<WeatherInfo> pastWeather(double lat, double log, LocalDate from, LocalDate to) { String path = HOST + String.format(PATH_PAST_WEATHER, lat, log, from, to, WEATHER_KEY); List<WeatherInfo> infos = new ArrayList<>(); try( InputStream in = new URL(path).openStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(in))) { String line; while (reader.readLine().startsWith("#")) { } reader.readLine(); while ((line = reader.readLine()) != null) { infos.add(WeatherInfo.valueOf(line)); reader.readLine(); } } catch (IOException e) { throw new RuntimeException(e); } return infos; }  }
WeatherWebApi { public List<WeatherInfo> pastWeather(double lat, double log, LocalDate from, LocalDate to) { String path = HOST + String.format(PATH_PAST_WEATHER, lat, log, from, to, WEATHER_KEY); List<WeatherInfo> infos = new ArrayList<>(); try( InputStream in = new URL(path).openStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(in))) { String line; while (reader.readLine().startsWith("#")) { } reader.readLine(); while ((line = reader.readLine()) != null) { infos.add(WeatherInfo.valueOf(line)); reader.readLine(); } } catch (IOException e) { throw new RuntimeException(e); } return infos; }  List<WeatherInfo> pastWeather(double lat, double log, LocalDate from, LocalDate to); List<LocationInfo> search(String query); }
WeatherWebApi { public List<WeatherInfo> pastWeather(double lat, double log, LocalDate from, LocalDate to) { String path = HOST + String.format(PATH_PAST_WEATHER, lat, log, from, to, WEATHER_KEY); List<WeatherInfo> infos = new ArrayList<>(); try( InputStream in = new URL(path).openStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(in))) { String line; while (reader.readLine().startsWith("#")) { } reader.readLine(); while ((line = reader.readLine()) != null) { infos.add(WeatherInfo.valueOf(line)); reader.readLine(); } } catch (IOException e) { throw new RuntimeException(e); } return infos; }  List<WeatherInfo> pastWeather(double lat, double log, LocalDate from, LocalDate to); List<LocationInfo> search(String query);  }