CompareComply extends BaseService { public ServiceCall<CompareReturn> compareDocuments( CompareDocumentsOptions compareDocumentsOptions) { com.ibm.cloud.sdk.core.util.Validator.notNull( compareDocumentsOptions, "compareDocumentsOptions cannot be null"); String[] pathSegments = {"v1/comparison"}; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("compare-comply", "v1", "compareDocuments"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); if (compareDocumentsOptions.file1Label() != null) { builder.query("file_1_label", compareDocumentsOptions.file1Label()); } if (compareDocumentsOptions.file2Label() != null) { builder.query("file_2_label", compareDocumentsOptions.file2Label()); } if (compareDocumentsOptions.model() != null) { builder.query("model", compareDocumentsOptions.model()); } MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); multipartBuilder.setType(MultipartBody.FORM); okhttp3.RequestBody file1Body = RequestUtils.inputStreamBody( compareDocumentsOptions.file1(), compareDocumentsOptions.file1ContentType()); multipartBuilder.addFormDataPart("file_1", "filename", file1Body); okhttp3.RequestBody file2Body = RequestUtils.inputStreamBody( compareDocumentsOptions.file2(), compareDocumentsOptions.file2ContentType()); multipartBuilder.addFormDataPart("file_2", "filename", file2Body); builder.body(multipartBuilder.build()); ResponseConverter<CompareReturn> responseConverter = ResponseConverterUtils.getValue( new com.google.gson.reflect.TypeToken<CompareReturn>() {}.getType()); return createServiceCall(builder.build(), responseConverter); } CompareComply(String versionDate);  CompareComply(String versionDate, Authenticator authenticator);  CompareComply(String versionDate, String serviceName);  CompareComply(String versionDate, String serviceName, Authenticator authenticator); ServiceCall<HTMLReturn> convertToHtml(ConvertToHtmlOptions convertToHtmlOptions); ServiceCall<ClassifyReturn> classifyElements(
      ClassifyElementsOptions classifyElementsOptions); ServiceCall<TableReturn> extractTables(ExtractTablesOptions extractTablesOptions); ServiceCall<CompareReturn> compareDocuments(
      CompareDocumentsOptions compareDocumentsOptions); ServiceCall<FeedbackReturn> addFeedback(AddFeedbackOptions addFeedbackOptions); ServiceCall<FeedbackList> listFeedback(ListFeedbackOptions listFeedbackOptions); ServiceCall<FeedbackList> listFeedback(); ServiceCall<GetFeedback> getFeedback(GetFeedbackOptions getFeedbackOptions); ServiceCall<FeedbackDeleted> deleteFeedback(DeleteFeedbackOptions deleteFeedbackOptions); ServiceCall<BatchStatus> createBatch(CreateBatchOptions createBatchOptions); ServiceCall<Batches> listBatches(ListBatchesOptions listBatchesOptions); ServiceCall<Batches> listBatches(); ServiceCall<BatchStatus> getBatch(GetBatchOptions getBatchOptions); ServiceCall<BatchStatus> updateBatch(UpdateBatchOptions updateBatchOptions);  }
@Test public void testCompareDocuments() throws FileNotFoundException, InterruptedException { server.enqueue(jsonResponse(compareDocumentsResponse)); CompareDocumentsOptions compareDocumentsOptions = new CompareDocumentsOptions.Builder().file1(SAMPLE_PDF).file2(SAMPLE_PDF).build(); CompareReturn response = service.compareDocuments(compareDocumentsOptions).execute().getResult(); RecordedRequest request = server.takeRequest(); assertEquals(COMPARE_DOCUMENTS_PATH, request.getPath()); assertEquals(TITLE, response.getDocuments().get(0).getTitle()); assertEquals(HTML, response.getDocuments().get(0).getHtml()); assertEquals(HASH, response.getDocuments().get(0).getHash()); assertEquals(LABEL, response.getDocuments().get(0).getLabel()); assertEquals( DOCUMENT_LABEL, response.getAlignedElements().get(0).getElementPair().get(0).getDocumentLabel()); assertEquals(TEXT, response.getAlignedElements().get(0).getElementPair().get(0).getText()); assertEquals( BEGIN, response.getAlignedElements().get(0).getElementPair().get(0).getLocation().begin()); assertEquals( END, response.getAlignedElements().get(0).getElementPair().get(0).getLocation().end()); assertEquals( NATURE, response .getAlignedElements() .get(0) .getElementPair() .get(0) .getTypes() .get(0) .getLabel() .nature()); assertEquals( PARTY, response .getAlignedElements() .get(0) .getElementPair() .get(0) .getTypes() .get(0) .getLabel() .party()); assertEquals( LABEL, response .getAlignedElements() .get(0) .getElementPair() .get(0) .getCategories() .get(0) .getLabel()); assertEquals( TYPE, response .getAlignedElements() .get(0) .getElementPair() .get(0) .getAttributes() .get(0) .getType()); assertEquals( TEXT, response .getAlignedElements() .get(0) .getElementPair() .get(0) .getAttributes() .get(0) .getText()); assertEquals( BEGIN, response .getAlignedElements() .get(0) .getElementPair() .get(0) .getAttributes() .get(0) .getLocation() .begin()); assertEquals( END, response .getAlignedElements() .get(0) .getElementPair() .get(0) .getAttributes() .get(0) .getLocation() .end()); assertEquals(true, response.getAlignedElements().get(0).isIdenticalText()); assertEquals(PROVENANCE_ID, response.getAlignedElements().get(0).getProvenanceIds().get(0)); assertTrue(response.getAlignedElements().get(0).isSignificantElements()); assertEquals(DOCUMENT_LABEL, response.getUnalignedElements().get(0).getDocumentLabel()); assertEquals(TEXT, response.getUnalignedElements().get(0).getText()); assertEquals(BEGIN, response.getUnalignedElements().get(0).getLocation().begin()); assertEquals(END, response.getUnalignedElements().get(0).getLocation().end()); assertEquals( NATURE, response.getUnalignedElements().get(0).getTypes().get(0).getLabel().nature()); assertEquals( PARTY, response.getUnalignedElements().get(0).getTypes().get(0).getLabel().party()); assertEquals(LABEL, response.getUnalignedElements().get(0).getCategories().get(0).getLabel()); assertEquals(TYPE, response.getUnalignedElements().get(0).getAttributes().get(0).getType()); assertEquals(TEXT, response.getUnalignedElements().get(0).getAttributes().get(0).getText()); assertEquals( BEGIN, response.getUnalignedElements().get(0).getAttributes().get(0).getLocation().begin()); assertEquals( END, response.getUnalignedElements().get(0).getAttributes().get(0).getLocation().end()); assertEquals(MODEL_ID, response.getModelId()); assertEquals(MODEL_VERSION, response.getModelVersion()); }