Discovery extends BaseService { public ServiceCall<DocumentAccepted> updateDocument(UpdateDocumentOptions updateDocumentOptions) { com.ibm.cloud.sdk.core.util.Validator.notNull( updateDocumentOptions, "updateDocumentOptions cannot be null"); com.ibm.cloud.sdk.core.util.Validator.isTrue( (updateDocumentOptions.file() != null) || (updateDocumentOptions.metadata() != null), "At least one of file or metadata must be supplied."); String[] pathSegments = {"v2/projects", "collections", "documents"}; String[] pathParameters = { updateDocumentOptions.projectId(), updateDocumentOptions.collectionId(), updateDocumentOptions.documentId() }; RequestBuilder builder = RequestBuilder.post( RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v2", "updateDocument"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); if (updateDocumentOptions.xWatsonDiscoveryForce() != null) { builder.header("X-Watson-Discovery-Force", updateDocumentOptions.xWatsonDiscoveryForce()); } MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); if (updateDocumentOptions.file() != null) { okhttp3.RequestBody fileBody = RequestUtils.inputStreamBody( updateDocumentOptions.file(), updateDocumentOptions.fileContentType()); multipartBuilder.addFormDataPart("file", updateDocumentOptions.filename(), fileBody); } if (updateDocumentOptions.metadata() != null) { multipartBuilder.addFormDataPart("metadata", updateDocumentOptions.metadata()); } builder.body(multipartBuilder.build()); ResponseConverter<DocumentAccepted> responseConverter = ResponseConverterUtils.getValue( new com.google.gson.reflect.TypeToken<DocumentAccepted>() {}.getType()); return createServiceCall(builder.build(), responseConverter); } Discovery(String versionDate);  Discovery(String versionDate, Authenticator authenticator);  Discovery(String versionDate, String serviceName);  Discovery(String versionDate, String serviceName, Authenticator authenticator); ServiceCall<ListCollectionsResponse> listCollections(
      ListCollectionsOptions listCollectionsOptions); ServiceCall<CollectionDetails> createCollection(
      CreateCollectionOptions createCollectionOptions); ServiceCall<CollectionDetails> getCollection(GetCollectionOptions getCollectionOptions); ServiceCall<CollectionDetails> updateCollection(
      UpdateCollectionOptions updateCollectionOptions); ServiceCall<Void> deleteCollection(DeleteCollectionOptions deleteCollectionOptions); ServiceCall<QueryResponse> query(QueryOptions queryOptions); ServiceCall<Completions> getAutocompletion(
      GetAutocompletionOptions getAutocompletionOptions); ServiceCall<QueryNoticesResponse> queryNotices(QueryNoticesOptions queryNoticesOptions); ServiceCall<ListFieldsResponse> listFields(ListFieldsOptions listFieldsOptions); ServiceCall<ComponentSettingsResponse> getComponentSettings(
      GetComponentSettingsOptions getComponentSettingsOptions); ServiceCall<DocumentAccepted> addDocument(AddDocumentOptions addDocumentOptions); ServiceCall<DocumentAccepted> updateDocument(UpdateDocumentOptions updateDocumentOptions); ServiceCall<DeleteDocumentResponse> deleteDocument(
      DeleteDocumentOptions deleteDocumentOptions); ServiceCall<TrainingQuerySet> listTrainingQueries(
      ListTrainingQueriesOptions listTrainingQueriesOptions); ServiceCall<Void> deleteTrainingQueries(
      DeleteTrainingQueriesOptions deleteTrainingQueriesOptions); ServiceCall<TrainingQuery> createTrainingQuery(
      CreateTrainingQueryOptions createTrainingQueryOptions); ServiceCall<TrainingQuery> getTrainingQuery(
      GetTrainingQueryOptions getTrainingQueryOptions); ServiceCall<TrainingQuery> updateTrainingQuery(
      UpdateTrainingQueryOptions updateTrainingQueryOptions); ServiceCall<Enrichments> listEnrichments(ListEnrichmentsOptions listEnrichmentsOptions); ServiceCall<Enrichment> createEnrichment(CreateEnrichmentOptions createEnrichmentOptions); ServiceCall<Enrichment> getEnrichment(GetEnrichmentOptions getEnrichmentOptions); ServiceCall<Enrichment> updateEnrichment(UpdateEnrichmentOptions updateEnrichmentOptions); ServiceCall<Void> deleteEnrichment(DeleteEnrichmentOptions deleteEnrichmentOptions); ServiceCall<ListProjectsResponse> listProjects(ListProjectsOptions listProjectsOptions); ServiceCall<ListProjectsResponse> listProjects(); ServiceCall<ProjectDetails> createProject(CreateProjectOptions createProjectOptions); ServiceCall<ProjectDetails> getProject(GetProjectOptions getProjectOptions); ServiceCall<ProjectDetails> updateProject(UpdateProjectOptions updateProjectOptions); ServiceCall<Void> deleteProject(DeleteProjectOptions deleteProjectOptions); ServiceCall<Void> deleteUserData(DeleteUserDataOptions deleteUserDataOptions);  }
@Test public void testUpdateDocument() { server.enqueue(jsonResponse(documentAccepted)); UpdateDocumentOptions options = new UpdateDocumentOptions.Builder() .projectId(PROJECT_ID) .collectionId(COLLECTION_ID) .documentId(DOCUMENT_ID) .file(testDocument) .filename(FILENAME) .build(); DocumentAccepted response = service.updateDocument(options).execute().getResult(); assertEquals(DOCUMENT_ID, response.getDocumentId()); assertEquals(STATUS, response.getStatus()); }