@Test public void shouldMakeRemoteGetCalls() { Robolectric.getBackgroundScheduler().pause(); TestGetRequest apiRequest = new TestGetRequest(); apiGateway.makeRequest(apiRequest, responseCallbacks); Robolectric.addPendingHttpResponse(200, GENERIC_XML); Robolectric.getBackgroundScheduler().runOneTask(); HttpRequestInfo sentHttpRequestData = Robolectric.getSentHttpRequestInfo(0); HttpRequest sentHttpRequest = sentHttpRequestData.getHttpRequest(); assertThat(sentHttpRequest.getRequestLine().getUri(), equalTo("www.example.com")); assertThat(sentHttpRequest.getRequestLine().getMethod(), equalTo(HttpGet.METHOD_NAME)); assertThat(sentHttpRequest.getHeaders("foo")[0].getValue(), equalTo("bar")); CredentialsProvider credentialsProvider = (CredentialsProvider) sentHttpRequestData.getHttpContext().getAttribute(ClientContext.CREDS_PROVIDER); assertThat(credentialsProvider.getCredentials(AuthScope.ANY).getUserPrincipal().getName(), CoreMatchers.equalTo("spongebob")); assertThat(credentialsProvider.getCredentials(AuthScope.ANY).getPassword(), CoreMatchers.equalTo("squarepants")); }
public <T extends ApiResponse> void makeRequest(ApiRequest<T> apiRequest, final ApiResponseCallbacks<T> responseCallbacks) { new RemoteCallTask(responseCallbacks).execute(apiRequest); }
ApiGateway { public <T extends ApiResponse> void makeRequest(ApiRequest<T> apiRequest, final ApiResponseCallbacks<T> responseCallbacks) { new RemoteCallTask(responseCallbacks).execute(apiRequest); } }
ApiGateway { public <T extends ApiResponse> void makeRequest(ApiRequest<T> apiRequest, final ApiResponseCallbacks<T> responseCallbacks) { new RemoteCallTask(responseCallbacks).execute(apiRequest); }  }
ApiGateway { public <T extends ApiResponse> void makeRequest(ApiRequest<T> apiRequest, final ApiResponseCallbacks<T> responseCallbacks) { new RemoteCallTask(responseCallbacks).execute(apiRequest); }  void makeRequest(ApiRequest<T> apiRequest, final ApiResponseCallbacks<T> responseCallbacks); }
ApiGateway { public <T extends ApiResponse> void makeRequest(ApiRequest<T> apiRequest, final ApiResponseCallbacks<T> responseCallbacks) { new RemoteCallTask(responseCallbacks).execute(apiRequest); }  void makeRequest(ApiRequest<T> apiRequest, final ApiResponseCallbacks<T> responseCallbacks);  }