@Test public void testTickHistoryWeatherAtStation () throws IOException, JSONException { HttpClient mockHttpClient = createHttpClientThatRespondsWith (TestData.HISTORY_WEATHER_AT_STATION_ID_BY_TICK); OwmClient owm = new OwmClient (mockHttpClient); WeatherHistoryStationResponse history = owm.historyWeatherAtStation (9040, HistoryType.TICK); assertEquals (1.5991d, history.getCalcTime (), 0.0001d); assertEquals (0.0456d, history.getCalcTimeTick (), 0.0001d); assertEquals (9040, history.getStationId ()); assertEquals (OwmClient.HistoryType.TICK, history.getType ()); assertTrue (history.hasHistory ()); }
public WeatherHistoryStationResponse historyWeatherAtStation (int stationId, HistoryType type) throws JSONException, IOException { if (type == HistoryType.UNKNOWN) throw new IllegalArgumentException("Can't do a historic request for unknown type of history."); String subUrl = String.format (Locale.ROOT, "history/station/%d?type=%s", stationId, type); JSONObject response = doQuery (subUrl); return new WeatherHistoryStationResponse (response); }
OwmClient { public WeatherHistoryStationResponse historyWeatherAtStation (int stationId, HistoryType type) throws JSONException, IOException { if (type == HistoryType.UNKNOWN) throw new IllegalArgumentException("Can't do a historic request for unknown type of history."); String subUrl = String.format (Locale.ROOT, "history/station/%d?type=%s", stationId, type); JSONObject response = doQuery (subUrl); return new WeatherHistoryStationResponse (response); } }
OwmClient { public WeatherHistoryStationResponse historyWeatherAtStation (int stationId, HistoryType type) throws JSONException, IOException { if (type == HistoryType.UNKNOWN) throw new IllegalArgumentException("Can't do a historic request for unknown type of history."); String subUrl = String.format (Locale.ROOT, "history/station/%d?type=%s", stationId, type); JSONObject response = doQuery (subUrl); return new WeatherHistoryStationResponse (response); } OwmClient();  OwmClient(HttpClient httpClient); }
OwmClient { public WeatherHistoryStationResponse historyWeatherAtStation (int stationId, HistoryType type) throws JSONException, IOException { if (type == HistoryType.UNKNOWN) throw new IllegalArgumentException("Can't do a historic request for unknown type of history."); String subUrl = String.format (Locale.ROOT, "history/station/%d?type=%s", stationId, type); JSONObject response = doQuery (subUrl); return new WeatherHistoryStationResponse (response); } OwmClient();  OwmClient(HttpClient httpClient); void setAPPID(String appid); WeatherStatusResponse currentWeatherAroundPoint(float lat, float lon, int cnt); WeatherStatusResponse currentWeatherAtCity(float lat, float lon, int cnt); WeatherStatusResponse currentWeatherInBoundingBox(float northLat, float westLon, float southLat, float eastLon); WeatherStatusResponse currentWeatherAtCityBoundingBox(float northLat, float westLon, float southLat, float eastLon); WeatherStatusResponse currentWeatherInCircle(float lat, float lon, float radius); WeatherStatusResponse currentWeatherAtCityCircle(float lat, float lon, float radius); StatusWeatherData currentWeatherAtCity(int cityId); StatusWeatherData currentWeatherAtStation(int stationId); WeatherStatusResponse currentWeatherAtCity(String cityName); WeatherStatusResponse currentWeatherAtCity(String cityName, String countryCode); WeatherForecastResponse forecastWeatherAtCity(int cityId); WeatherForecastResponse forecastWeatherAtCity(String cityName); WeatherHistoryCityResponse historyWeatherAtCity(int cityId, HistoryType type); WeatherHistoryStationResponse historyWeatherAtStation(int stationId, HistoryType type); }
OwmClient { public WeatherHistoryStationResponse historyWeatherAtStation (int stationId, HistoryType type) throws JSONException, IOException { if (type == HistoryType.UNKNOWN) throw new IllegalArgumentException("Can't do a historic request for unknown type of history."); String subUrl = String.format (Locale.ROOT, "history/station/%d?type=%s", stationId, type); JSONObject response = doQuery (subUrl); return new WeatherHistoryStationResponse (response); } OwmClient();  OwmClient(HttpClient httpClient); void setAPPID(String appid); WeatherStatusResponse currentWeatherAroundPoint(float lat, float lon, int cnt); WeatherStatusResponse currentWeatherAtCity(float lat, float lon, int cnt); WeatherStatusResponse currentWeatherInBoundingBox(float northLat, float westLon, float southLat, float eastLon); WeatherStatusResponse currentWeatherAtCityBoundingBox(float northLat, float westLon, float southLat, float eastLon); WeatherStatusResponse currentWeatherInCircle(float lat, float lon, float radius); WeatherStatusResponse currentWeatherAtCityCircle(float lat, float lon, float radius); StatusWeatherData currentWeatherAtCity(int cityId); StatusWeatherData currentWeatherAtStation(int stationId); WeatherStatusResponse currentWeatherAtCity(String cityName); WeatherStatusResponse currentWeatherAtCity(String cityName, String countryCode); WeatherForecastResponse forecastWeatherAtCity(int cityId); WeatherForecastResponse forecastWeatherAtCity(String cityName); WeatherHistoryCityResponse historyWeatherAtCity(int cityId, HistoryType type); WeatherHistoryStationResponse historyWeatherAtStation(int stationId, HistoryType type);  }