@Test public void testGet() throws ControlPointApiException, IOException { final int result = defaultCPClient.get("status", Arrays.asList( new BasicNameValuePair("version", "3"), new BasicNameValuePair("format", "standard") ), Integer.class); final List<HttpUriRequest> requests = getRequests(2); Assert.assertEquals("first request should be POST", "POST", requests.get(0).getMethod()); final HttpPost loginReq = (HttpPost) requests.get(0); Assert.assertEquals("first request should be login", "http: loginReq.getURI().toString()); Assert.assertEquals("first request should include credentials", "grant_type=password&username=cp-user&password=cp-pass", IOUtils.toString(loginReq.getEntity().getContent())); Assert.assertEquals("second request should be GET", "GET", requests.get(1).getMethod()); Assert.assertEquals("second request should have correct URL", "http: requests.get(1).getURI().toString()); Assert.assertEquals("second request should include auth token", "Bearer the token", requests.get(1).getFirstHeader(HttpHeaders.AUTHORIZATION).getValue()); Assert.assertEquals("should parse result", 456, result); }
public <R> R get( final String path, final List<NameValuePair> queryParams, final Class<R> resultType ) throws ControlPointApiException { return performAuthenticatedRequest(buildGetRequest(path, queryParams), resultType); }
ControlPointApiClient { public <R> R get( final String path, final List<NameValuePair> queryParams, final Class<R> resultType ) throws ControlPointApiException { return performAuthenticatedRequest(buildGetRequest(path, queryParams), resultType); } }
ControlPointApiClient { public <R> R get( final String path, final List<NameValuePair> queryParams, final Class<R> resultType ) throws ControlPointApiException { return performAuthenticatedRequest(buildGetRequest(path, queryParams), resultType); }  }
ControlPointApiClient { public <R> R get( final String path, final List<NameValuePair> queryParams, final Class<R> resultType ) throws ControlPointApiException { return performAuthenticatedRequest(buildGetRequest(path, queryParams), resultType); }  R get(
        final String path,
        final List<NameValuePair> queryParams,
        final Class<R> resultType
    ); R postUrlencoded(
        final String path,
        final List<NameValuePair> queryParams,
        final List<NameValuePair> bodyParams,
        final Class<R> resultType
    ); }
ControlPointApiClient { public <R> R get( final String path, final List<NameValuePair> queryParams, final Class<R> resultType ) throws ControlPointApiException { return performAuthenticatedRequest(buildGetRequest(path, queryParams), resultType); }  R get(
        final String path,
        final List<NameValuePair> queryParams,
        final Class<R> resultType
    ); R postUrlencoded(
        final String path,
        final List<NameValuePair> queryParams,
        final List<NameValuePair> bodyParams,
        final Class<R> resultType
    );  }