@Test public void testGetResponseData() throws Exception { JSONObject jsonObject = new JSONObject(); jsonObject.put("testStr", "string data"); jsonObject.put("testNum", 123); jsonObject.put("testBoolean", true); JSONObject responseData = target.getResponseData(new TestStringInputStream(jsonObject.toString(), CHARSET_NAME)); assertEquals("string data", responseData.optString("testStr")); assertEquals(123, responseData.optInt("testNum")); assertTrue(responseData.optBoolean("testBoolean")); }
@Override @NonNull public JSONObject getResponseData(@NonNull InputStream inputStream) throws IOException { try { return new JSONObject(stringResponseParser.getResponseData(inputStream)); } catch (JSONException e) { throw new IOException(e); } }
JsonResponseParser implements ResponseDataParser<JSONObject> { @Override @NonNull public JSONObject getResponseData(@NonNull InputStream inputStream) throws IOException { try { return new JSONObject(stringResponseParser.getResponseData(inputStream)); } catch (JSONException e) { throw new IOException(e); } } }
JsonResponseParser implements ResponseDataParser<JSONObject> { @Override @NonNull public JSONObject getResponseData(@NonNull InputStream inputStream) throws IOException { try { return new JSONObject(stringResponseParser.getResponseData(inputStream)); } catch (JSONException e) { throw new IOException(e); } } JsonResponseParser();  JsonResponseParser(@NonNull String charsetName); }
JsonResponseParser implements ResponseDataParser<JSONObject> { @Override @NonNull public JSONObject getResponseData(@NonNull InputStream inputStream) throws IOException { try { return new JSONObject(stringResponseParser.getResponseData(inputStream)); } catch (JSONException e) { throw new IOException(e); } } JsonResponseParser();  JsonResponseParser(@NonNull String charsetName); @Override @NonNull JSONObject getResponseData(@NonNull InputStream inputStream); }
JsonResponseParser implements ResponseDataParser<JSONObject> { @Override @NonNull public JSONObject getResponseData(@NonNull InputStream inputStream) throws IOException { try { return new JSONObject(stringResponseParser.getResponseData(inputStream)); } catch (JSONException e) { throw new IOException(e); } } JsonResponseParser();  JsonResponseParser(@NonNull String charsetName); @Override @NonNull JSONObject getResponseData(@NonNull InputStream inputStream);  }