@Test public void testUpload() throws Throwable { mockHttpClient = mock(HttpClient.class); RestClient restClient = new RestClient(endpoint, null, mockHttpClient); ArgumentCaptor<HttpPost> httpPostArgumentCaptor = ArgumentCaptor.forClass(HttpPost.class); restClient.upload("path", "filename", ImmutableMap.<String, String>of()); verify(mockHttpClient).execute(httpPostArgumentCaptor.capture()); assertEquals(httpPostArgumentCaptor.getValue().getEntity().getClass(), MultipartEntity.class); }
public HttpResponse upload(String path, String inputFileName, Map<String, String> arguments) throws IOException { return upload(path, new FileBody(new File(inputFileName), "application/octet-stream"), arguments); }
RestClient { public HttpResponse upload(String path, String inputFileName, Map<String, String> arguments) throws IOException { return upload(path, new FileBody(new File(inputFileName), "application/octet-stream"), arguments); } }
RestClient { public HttpResponse upload(String path, String inputFileName, Map<String, String> arguments) throws IOException { return upload(path, new FileBody(new File(inputFileName), "application/octet-stream"), arguments); } RestClient(String target, CloseableHttpAsyncClient asyncClient);  RestClient(String target, CloseableHttpAsyncClient asyncClient, String sharedSecret);  RestClient(String target, CloseableHttpAsyncClient asyncClient, HttpClient mockHttpClient); }
RestClient { public HttpResponse upload(String path, String inputFileName, Map<String, String> arguments) throws IOException { return upload(path, new FileBody(new File(inputFileName), "application/octet-stream"), arguments); } RestClient(String target, CloseableHttpAsyncClient asyncClient);  RestClient(String target, CloseableHttpAsyncClient asyncClient, String sharedSecret);  RestClient(String target, CloseableHttpAsyncClient asyncClient, HttpClient mockHttpClient); HttpResponse perform(final Method method, final String path, final HttpEntity payload); Future<HttpResponse> performAsync(final Method method, final String path, final HttpEntity payload,
                                           final FutureCallback<HttpResponse> responseHandler); void checkResponse(HttpResponse httpResponse, int expected); T parseHttpResponse(HttpResponse response, TypeReference<T> classType); HttpResponse upload(String path, String inputFileName, Map<String, String> arguments); HttpResponse upload(String path, FileBody fileBody, Map<String, String> arguments); }
RestClient { public HttpResponse upload(String path, String inputFileName, Map<String, String> arguments) throws IOException { return upload(path, new FileBody(new File(inputFileName), "application/octet-stream"), arguments); } RestClient(String target, CloseableHttpAsyncClient asyncClient);  RestClient(String target, CloseableHttpAsyncClient asyncClient, String sharedSecret);  RestClient(String target, CloseableHttpAsyncClient asyncClient, HttpClient mockHttpClient); HttpResponse perform(final Method method, final String path, final HttpEntity payload); Future<HttpResponse> performAsync(final Method method, final String path, final HttpEntity payload,
                                           final FutureCallback<HttpResponse> responseHandler); void checkResponse(HttpResponse httpResponse, int expected); T parseHttpResponse(HttpResponse response, TypeReference<T> classType); HttpResponse upload(String path, String inputFileName, Map<String, String> arguments); HttpResponse upload(String path, FileBody fileBody, Map<String, String> arguments); static final String AUTHORIZATION_HEADER; static final String AUTHORIZATION_METHOD; }