@Test(expected = IOException.class) public void parseInvalidVersionsResponse() throws IOException { String invalidJsonResponse = "---"; client.parseVersionsResponse(invalidJsonResponse); }
List<HockeyAppVersion> parseVersionsResponse(String responseContent) throws IOException { try { versions = new LinkedList<>(); JSONObject parsedJson = new JSONObject(responseContent); JSONArray versionArray = parsedJson.getJSONArray("app_versions"); for (int i = 0; i < versionArray.length(); i++) { JSONObject jsonObj = versionArray.getJSONObject(i); String shortVersion = jsonObj.getString("version"); versions.add(new HockeyAppVersion(shortVersion)); } return versions; } catch (JSONException e) { throw new IOException("returned JSON was invalid", e); } }
VersionClient { List<HockeyAppVersion> parseVersionsResponse(String responseContent) throws IOException { try { versions = new LinkedList<>(); JSONObject parsedJson = new JSONObject(responseContent); JSONArray versionArray = parsedJson.getJSONArray("app_versions"); for (int i = 0; i < versionArray.length(); i++) { JSONObject jsonObj = versionArray.getJSONObject(i); String shortVersion = jsonObj.getString("version"); versions.add(new HockeyAppVersion(shortVersion)); } return versions; } catch (JSONException e) { throw new IOException("returned JSON was invalid", e); } } }
VersionClient { List<HockeyAppVersion> parseVersionsResponse(String responseContent) throws IOException { try { versions = new LinkedList<>(); JSONObject parsedJson = new JSONObject(responseContent); JSONArray versionArray = parsedJson.getJSONArray("app_versions"); for (int i = 0; i < versionArray.length(); i++) { JSONObject jsonObj = versionArray.getJSONObject(i); String shortVersion = jsonObj.getString("version"); versions.add(new HockeyAppVersion(shortVersion)); } return versions; } catch (JSONException e) { throw new IOException("returned JSON was invalid", e); } } VersionClient(HockeyAppRequestBuilder requestBuilder); }
VersionClient { List<HockeyAppVersion> parseVersionsResponse(String responseContent) throws IOException { try { versions = new LinkedList<>(); JSONObject parsedJson = new JSONObject(responseContent); JSONArray versionArray = parsedJson.getJSONArray("app_versions"); for (int i = 0; i < versionArray.length(); i++) { JSONObject jsonObj = versionArray.getJSONObject(i); String shortVersion = jsonObj.getString("version"); versions.add(new HockeyAppVersion(shortVersion)); } return versions; } catch (JSONException e) { throw new IOException("returned JSON was invalid", e); } } VersionClient(HockeyAppRequestBuilder requestBuilder); HockeyAppVersion getVersion(); }
VersionClient { List<HockeyAppVersion> parseVersionsResponse(String responseContent) throws IOException { try { versions = new LinkedList<>(); JSONObject parsedJson = new JSONObject(responseContent); JSONArray versionArray = parsedJson.getJSONArray("app_versions"); for (int i = 0; i < versionArray.length(); i++) { JSONObject jsonObj = versionArray.getJSONObject(i); String shortVersion = jsonObj.getString("version"); versions.add(new HockeyAppVersion(shortVersion)); } return versions; } catch (JSONException e) { throw new IOException("returned JSON was invalid", e); } } VersionClient(HockeyAppRequestBuilder requestBuilder); HockeyAppVersion getVersion();  }