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