@Test(expected = IllegalStateException.class) public void withTargetClassMethodShouldThrowIllegalStateExceptionWhenSetTargetClassMethodIsCalledAgain() { String url = "test"; HttpMethod method = HttpMethod.GET; VolleyerConfiguration configuration = DefaultVolleyerConfigurationFactory.create(); TestPurposeRequestBuilder builder = new TestPurposeRequestBuilder(requestQueue, configuration, url, method); Class<String> clazz = String.class; builder.withTargetClass(clazz); builder.withTargetClass(clazz); }
public <T> ResponseBuilder<T> withTargetClass(Class<T> clazz) { Assert.notNull(clazz, "Target Class token"); assertFinishState(); ResponseBuilder<T> builder = new ResponseBuilder<T>(requestQueue, configuration, httpContent, clazz); markFinishState(); return builder; }
RequestBuilder { public <T> ResponseBuilder<T> withTargetClass(Class<T> clazz) { Assert.notNull(clazz, "Target Class token"); assertFinishState(); ResponseBuilder<T> builder = new ResponseBuilder<T>(requestQueue, configuration, httpContent, clazz); markFinishState(); return builder; } }
RequestBuilder { public <T> ResponseBuilder<T> withTargetClass(Class<T> clazz) { Assert.notNull(clazz, "Target Class token"); assertFinishState(); ResponseBuilder<T> builder = new ResponseBuilder<T>(requestQueue, configuration, httpContent, clazz); markFinishState(); return builder; } RequestBuilder(RequestQueue requestQueue, VolleyerConfiguration configuration, String url, HttpMethod method); }
RequestBuilder { public <T> ResponseBuilder<T> withTargetClass(Class<T> clazz) { Assert.notNull(clazz, "Target Class token"); assertFinishState(); ResponseBuilder<T> builder = new ResponseBuilder<T>(requestQueue, configuration, httpContent, clazz); markFinishState(); return builder; } RequestBuilder(RequestQueue requestQueue, VolleyerConfiguration configuration, String url, HttpMethod method); @SuppressWarnings("unchecked") B addHeader(String key, String value); ResponseBuilder<T> withTargetClass(Class<T> clazz); ResponseBuilder<String> withListener(Listener<String> listener); ResponseBuilder<String> withErrorListener(ErrorListener errorListener); Request<Void> execute(); }
RequestBuilder { public <T> ResponseBuilder<T> withTargetClass(Class<T> clazz) { Assert.notNull(clazz, "Target Class token"); assertFinishState(); ResponseBuilder<T> builder = new ResponseBuilder<T>(requestQueue, configuration, httpContent, clazz); markFinishState(); return builder; } RequestBuilder(RequestQueue requestQueue, VolleyerConfiguration configuration, String url, HttpMethod method); @SuppressWarnings("unchecked") B addHeader(String key, String value); ResponseBuilder<T> withTargetClass(Class<T> clazz); ResponseBuilder<String> withListener(Listener<String> listener); ResponseBuilder<String> withErrorListener(ErrorListener errorListener); Request<Void> execute();  }