FileApiClientImpl extends TokenProviderAwareClient implements FileApiClient { @Override public UploadFileData uploadFile(File fileToUpload, FileUploadParameterBuilder fileUploadParameterBuilder) throws SmartlingApiException { FileBody fileBody = new FileBody(fileToUpload, createContentType(fileUploadParameterBuilder.getFileType(), getCharset(fileUploadParameterBuilder)), fileToUpload.getName()); return uploadFile(fileUploadParameterBuilder, fileBody); } 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 testUploadFile() throws Exception { when(response.getContents()).thenReturn(ResponseExamples.UPLOAD_RESPONSE); UploadFileData uploadFileDataResponse = fileApiClient.uploadFile(mock(File.class), newUploadParameters()); HttpRequestBase request = requestCaptor.getValue(); assertEquals(EXPECTED_AUTHORIZATION_HEADER, request.getFirstHeader(HttpHeaders.AUTHORIZATION).getValue()); assertEquals(HttpPost.class, request.getClass()); assertNotNull(((HttpPost)request).getEntity()); assertEquals("https: assertEquals(false, uploadFileDataResponse.isOverWritten()); assertEquals(1, uploadFileDataResponse.getStringCount()); assertEquals(2, uploadFileDataResponse.getWordCount()); }
@Test public void testUploadFileFromStream() throws Exception { when(response.getContents()).thenReturn(ResponseExamples.UPLOAD_RESPONSE); fileApiClient.uploadFile(mock(InputStream.class), FILE_URI, newUploadParameters()); HttpRequestBase request = requestCaptor.getValue(); assertEquals(EXPECTED_AUTHORIZATION_HEADER, request.getFirstHeader(HttpHeaders.AUTHORIZATION).getValue()); assertEquals(HttpPost.class, request.getClass()); assertNotNull(((HttpPost)request).getEntity()); assertEquals("https: }