RequestBuilder { public ResponseBuilder<String> withListener(Listener<String> listener) { assertFinishState(); ResponseBuilder<String> builder = withTargetClass(String.class); builder.withListener(listener); 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();  }
@Test(expected = IllegalStateException.class) public void requestBuilderShouldThrowIllegalStateExceptionWhensetListenerMethodIsCalledAgain() { String url = "http: HttpMethod method = HttpMethod.GET; VolleyerConfiguration configuration = DefaultVolleyerConfigurationFactory.create(); TestPurposeRequestBuilder builder = new TestPurposeRequestBuilder(requestQueue, configuration, url, method); Listener<String> listener = new Listener<String>(){ @Override public void onResponse(String response) { }}; builder.withListener(listener); builder.withListener(listener); }