RequestBuilder { public Request<Void> execute() { assertFinishState(); ResponseBuilder<Void> builder = withTargetClass(Void.class); return builder.execute(); } 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() public void requestQueueShouldBeExecutedWhenExecuteMethodIsCalled() { String url = "http: HttpMethod method = HttpMethod.GET; VolleyerConfiguration configuration = DefaultVolleyerConfigurationFactory.create(); TestPurposeRequestBuilder builder = new TestPurposeRequestBuilder(requestQueue, configuration, url, method); Request<Void> request = builder.execute(); verify(requestQueue).add(request); }
@Test(expected = IllegalStateException.class) public void requestBuilderShouldThrowIllegalStateExceptionWhenExecuteMethodIsCalledAgain() { String url = "http: HttpMethod method = HttpMethod.GET; VolleyerConfiguration configuration = DefaultVolleyerConfigurationFactory.create(); TestPurposeRequestBuilder builder = new TestPurposeRequestBuilder(requestQueue, configuration, url, method); builder.execute(); builder.execute(); }