FileApiClientImpl extends TokenProviderAwareClient implements FileApiClient { @Override public StringResponse getFilesArchive(GetFilesArchiveParameterBuilder builder) throws SmartlingApiException { final List<NameValuePair> paramsList = builder.getNameValueList(); final String params = buildParamsQuery(paramsList.toArray(new NameValuePair[paramsList.size()])); final HttpGet httpGet = new HttpGet(buildUrl(getApiUrl(FILES_API_V2_GET_FILES_ZIP), params)); final StringResponse response = executeRequest(httpGet); if (response.isSuccess()) { return response; } else { getApiV2Response(response.getContents(), new TypeToken<ApiV2ResponseWrapper<EmptyResponse>>() { } ).retrieveData(); throw new SmartlingApiException("Failed to get file content"); } } private  FileApiClientImpl(final TokenProvider tokenProvider, final String projectId, final ProxyConfiguration proxyConfiguration,
                              final String baseUrl, final HttpClientConfiguration httpClientConfiguration); @Override UploadFileData uploadFile(File fileToUpload, FileUploadParameterBuilder fileUploadParameterBuilder); @Override UploadFileData uploadFile(InputStream inputStream, String fileName, FileUploadParameterBuilder fileUploadParameterBuilder); @Override EmptyResponse deleteFile(String fileUri); @Override EmptyResponse renameFile(String fileUri, String newFileUri); @Override FileLastModified getLastModified(FileLastModifiedParameterBuilder builder); @Override StringResponse getFilesArchive(GetFilesArchiveParameterBuilder builder); @Override StringResponse getFile(GetFileParameterBuilder getFileParameterBuilder); @Override StringResponse getOriginalFile(GetOriginalFileParameterBuilder getFileParameterBuilder); @Override FileList getFilesList(FileListSearchParameterBuilder fileListSearchParameterBuilder); @Override FileLocaleStatus getFileLocaleStatus(String fileUri, String locale); @Override FileStatus getFileStatus(String fileUri); @Override FileImportSmartlingData importTranslations(FileImportParameterBuilder fileImportParameterBuilder);  }
@Test public void testGetFilesArchive() throws Exception { when(response.getContentsRaw()).thenReturn("contents of a zip file".getBytes()); StringResponse r = fileApiClient.getFilesArchive(new GetFilesArchiveParameterBuilder() .files(Arrays.asList("fileUri1", "fileUri2")) .localeIds(Arrays.asList("locale1", "locale2")) ); HttpRequestBase request = requestCaptor.getValue(); assertEquals("https: "?fileUris%5B%5D=fileUri1&fileUris%5B%5D=fileUri2&localeIds%5B%5D=locale1&localeIds%5B%5D=locale2", request.getURI().toString()); assertArrayEquals("contents of a zip file".getBytes(), r.getContentsRaw()); }