VolleyerRequest extends Request<T> implements MultipartContainer { protected Response<T> parseNetworkResponse(NetworkResponse response) { return responseParser.parseNetworkResponse(response, clazz); } VolleyerRequest(HttpContent httpContent, Class<T> clazz, NetworkResponseParser responseParser, Listener<T> listener, ErrorListener errorListener); @Override Map<String, String> getHeaders(); @Override byte[] getBody(); @Override boolean hasMultipart(); @Override Multipart getMultipart();  }
@Test public void responseShouldBeSuccessOnNormal() { String content = "test response"; NetworkResponse networkResponse = new NetworkResponse(content.getBytes()); VolleyerRequest<String> request = new VolleyerRequest<String>(httpContent, clazz, responseParser, listener, errorListener); Response<String> response = request.parseNetworkResponse(networkResponse); assertThat(response.isSuccess(), is(true)); assertThat(response.result, is(content)); }
@Test public void responseShouldFailWhenNetworkResponseParserIsWrong() { NetworkResponseParser otherResponseParser = new JacksonNetworkResponseParser(); String content = "test response"; NetworkResponse networkResponse = new NetworkResponse(content.getBytes()); VolleyerRequest<String> request = new VolleyerRequest<String>(httpContent, clazz, otherResponseParser, listener, errorListener); Response<String> response = request.parseNetworkResponse(networkResponse); assertThat(response.isSuccess(), is(false)); }