FileApiClientImpl extends TokenProviderAwareClient implements FileApiClient { @Override public StringResponse getOriginalFile(GetOriginalFileParameterBuilder getFileParameterBuilder) throws SmartlingApiException { final List<NameValuePair> paramsList = getFileParameterBuilder.getNameValueList(); final String params = buildParamsQuery(paramsList.toArray(new NameValuePair[paramsList.size()])); final HttpGet httpGet = new HttpGet(buildUrl(getApiUrl(FILES_API_V2_GET_ORIGINAL_FILE), 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 testGetOriginalFile() throws Exception { when(response.getContents()).thenReturn(ResponseExamples.GET_FILE_RESPONSE); fileApiClient.getOriginalFile(new GetOriginalFileParameterBuilder(FILE_URI)); HttpRequestBase request = requestCaptor.getValue(); assertEquals("https: }
@Test public void testShouldThrowSmartlingApiExceptionWithCodeAndDetailsIfCodeIsNotAcceptedOrSuccessWhenGetOriginalFile() throws Exception { when(response.isSuccess()).thenReturn(false); when(response.getContents()).thenReturn(ResponseExamples.ERROR_RESPONSE); expectedException.expect(SmartlingApiException.class); expectedException.expectMessage("MAINTENANCE_MODE_ERROR\n" + "Error{key='some_error', message='Some error', details=ErrorDetails{field='null', errorId='null'}}"); fileApiClient.getOriginalFile(new GetOriginalFileParameterBuilder(FILE_URI)); }