Skip to content

Commit 58e1e70

Browse files
committed
test(Compare and Comply): Fix failing integration test
1 parent 00bca43 commit 58e1e70

File tree

1 file changed

+45
-4
lines changed

1 file changed

+45
-4
lines changed

compare-comply/src/test/java/com/ibm/watson/compare_comply/v1/CompareComplyServiceIT.java

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.ibm.watson.compare_comply.v1.model.AddFeedbackOptions;
66
import com.ibm.watson.compare_comply.v1.model.BatchStatus;
77
import com.ibm.watson.compare_comply.v1.model.Batches;
8+
import com.ibm.watson.compare_comply.v1.model.Category;
89
import com.ibm.watson.compare_comply.v1.model.ClassifyElementsOptions;
910
import com.ibm.watson.compare_comply.v1.model.ClassifyReturn;
1011
import com.ibm.watson.compare_comply.v1.model.CompareDocumentsOptions;
@@ -20,10 +21,12 @@
2021
import com.ibm.watson.compare_comply.v1.model.GetFeedback;
2122
import com.ibm.watson.compare_comply.v1.model.GetFeedbackOptions;
2223
import com.ibm.watson.compare_comply.v1.model.HTMLReturn;
24+
import com.ibm.watson.compare_comply.v1.model.Label;
2325
import com.ibm.watson.compare_comply.v1.model.Location;
2426
import com.ibm.watson.compare_comply.v1.model.OriginalLabelsIn;
2527
import com.ibm.watson.compare_comply.v1.model.ShortDoc;
2628
import com.ibm.watson.compare_comply.v1.model.TableReturn;
29+
import com.ibm.watson.compare_comply.v1.model.TypeLabel;
2730
import com.ibm.watson.compare_comply.v1.model.UpdateBatchOptions;
2831
import com.ibm.watson.compare_comply.v1.model.UpdatedLabelsIn;
2932
import org.junit.Before;
@@ -32,6 +35,8 @@
3235

3336
import java.io.File;
3437
import java.io.FileNotFoundException;
38+
import java.util.ArrayList;
39+
import java.util.Arrays;
3540
import java.util.List;
3641

3742
import static org.junit.Assert.assertEquals;
@@ -111,20 +116,56 @@ public void testCompareDocuments() throws FileNotFoundException {
111116
public void testFeedbackOperations() {
112117
String userId = "lp_java";
113118
String comment = "could be better";
114-
String text = "This is some text from a contract about something.";
119+
String text = "1. IBM will provide a Senior Managing Consultant / expert resource, for up to 80 hours, to assist " +
120+
"Florida Power & Light (FPL) with the creation of an IT infrastructure unit cost model for existing " +
121+
"infrastructure.";
115122
ShortDoc shortDoc = new ShortDoc();
123+
shortDoc.setTitle("doc title");
124+
shortDoc.setHash("");
116125
Location location = new Location();
117-
location.setBegin(0L);
118-
location.setEnd(1L);
126+
location.setBegin(241);
127+
location.setEnd(237);
119128
OriginalLabelsIn originalLabelsIn = new OriginalLabelsIn();
129+
Label label1 = new Label();
130+
label1.setNature("Obligation");
131+
label1.setParty("IBM");
132+
List<String> ids1 = Arrays.asList("85f5981a-ba91-44f5-9efa-0bd22e64b7bc", "ce0480a1-5ef1-4c3e-9861-3743b5610795");
133+
TypeLabel typeLabel1 = new TypeLabel();
134+
typeLabel1.setLabel(label1);
135+
typeLabel1.setProvenanceIds(ids1);
136+
Label label2 = new Label();
137+
label2.setNature("End User");
138+
label2.setParty("Exclusion");
139+
List<String> ids2 = Arrays.asList("85f5981a-ba91-44f5-9efa-0bd22e64b7bc", "ce0480a1-5ef1-4c3e-9861-3743b5610795");
140+
TypeLabel typeLabel2 = new TypeLabel();
141+
typeLabel2.setLabel(label2);
142+
typeLabel2.setProvenanceIds(ids2);
143+
List<TypeLabel> types = Arrays.asList(typeLabel1, typeLabel2);
144+
originalLabelsIn.setTypes(types);
145+
Category category1 = new Category();
146+
category1.setLabel(Category.Label.RESPONSIBILITIES);
147+
category1.setProvenanceIds(new ArrayList<String>());
148+
Category category2 = new Category();
149+
category2.setLabel(Category.Label.AMENDMENTS);
150+
category2.setProvenanceIds(new ArrayList<String>());
151+
originalLabelsIn.setCategories(Arrays.asList(category1, category2));
120152
UpdatedLabelsIn updatedLabelsIn = new UpdatedLabelsIn();
153+
Label label3 = new Label();
154+
label3.setNature("Disclaimer");
155+
label3.setParty("buyer");
156+
TypeLabel typeLabel3 = new TypeLabel();
157+
typeLabel3.setLabel(label3);
158+
updatedLabelsIn.setTypes(Arrays.asList(typeLabel1, typeLabel3));
159+
updatedLabelsIn.setCategories(Arrays.asList(category1, category2));
121160
FeedbackDataInput feedbackDataInput = new FeedbackDataInput();
122161
feedbackDataInput.setDocument(shortDoc);
123162
feedbackDataInput.setLocation(location);
124163
feedbackDataInput.setText(text);
125164
feedbackDataInput.setOriginalLabels(originalLabelsIn);
126165
feedbackDataInput.setUpdatedLabels(updatedLabelsIn);
127166
feedbackDataInput.setFeedbackType("element_classification");
167+
feedbackDataInput.setModelId("contracts");
168+
feedbackDataInput.setModelVersion("11.00");
128169

129170
AddFeedbackOptions addFeedbackOptions = new AddFeedbackOptions.Builder()
130171
.userId(userId)
@@ -141,7 +182,7 @@ public void testFeedbackOperations() {
141182
.getFeedback(getFeedbackOptions)
142183
.addHeader("x-watson-metadata", "customer_id=sdk-test-customer-id")
143184
.execute().getResult();
144-
assertEquals(comment, getFeedback.getComment());
185+
assertEquals(text, getFeedback.getFeedbackData().getText());
145186

146187
DeleteFeedbackOptions deleteFeedbackOptions = new DeleteFeedbackOptions.Builder()
147188
.feedbackId(feedbackId)

0 commit comments

Comments
 (0)