### Question:
OpenWeatherMapWeather implements Weather { void parseOneCallResult(JSONObject json) throws WeatherException { try { checkCode(json); JSONArray list = json.getJSONArray("daily"); SimpleWeatherCondition condition = getCondition(0); if (list.length() > 0) { appendForecastTemperature(condition, list.getJSONObject(0)); condition.setConditionText(this.conditionFormat.getText(condition)); } for (int i = 1; i < list.length(); i++) { condition = getCondition(i); parseForecast(condition, list.getJSONObject(i)); condition.setConditionText(this.conditionFormat.getText(condition)); } } catch (JSONException e) { throw new WeatherException("Failed parsing one call response: " + e.getLocalizedMessage(), e); } } OpenWeatherMapWeather(Context context);  OpenWeatherMapWeather(Context context, JSONObject jsonObject); @Override Location getLocation(); @Override Date getTime(); @Override Date getQueryTime(); @Override UnitSystem getUnitSystem(); @Override List<WeatherCondition> getConditions(); @Override boolean isEmpty(); int getCityId(); URL getForecastURL();  }### Answer:
@Test public void testParseTooManyRequestCodeForOneCall() throws JSONException, WeatherException { JSONTokener parser = new JSONTokener("{ \"cod\": 429, \"message\": \"too many requests\"}"); try { OpenWeatherMapWeather weather = new OpenWeatherMapWeather(context); weather.parseOneCallResult((JSONObject) parser.nextValue()); fail(); } catch (TooManyRequestsException e) { assertEquals("too many requests", e.getMessage()); assertEquals("too many requests", e.getLocalizedMessage()); } }