Parser { List<Data> parseArray(JSONArray jsonArray) { List<Data> data = new ArrayList<Data>(jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { final JSONObject jsonObject = jsonArray.optJSONObject(i); data.add(parseObject(jsonObject)); } return data; }  List<Data> getModels(final InputStream inputStream);  }
@Test public void shouldParseArray() throws JSONException { List<Data> data = mParser.parseArray(new JSONArray("[{\"id\":1}]")); assertEquals(1, data.get(0).getId()); }