Skip to content

Commit 56ea4eb

Browse files
committed
test(Compare and Comply): Add unit tests for new functionality
1 parent 8b14846 commit 56ea4eb

3 files changed

Lines changed: 71 additions & 1 deletion

File tree

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
import com.ibm.watson.compare_comply.v1.model.BatchStatus;
2020
import com.ibm.watson.compare_comply.v1.model.Batches;
2121
import com.ibm.watson.compare_comply.v1.model.Category;
22-
import com.ibm.watson.compare_comply.v1.model.CategoryComparison;
2322
import com.ibm.watson.compare_comply.v1.model.ClassifyElementsOptions;
2423
import com.ibm.watson.compare_comply.v1.model.ClassifyReturn;
2524
import com.ibm.watson.compare_comply.v1.model.CompareDocumentsOptions;
2625
import com.ibm.watson.compare_comply.v1.model.CompareReturn;
2726
import com.ibm.watson.compare_comply.v1.model.ContractAmts;
27+
import com.ibm.watson.compare_comply.v1.model.ContractType;
2828
import com.ibm.watson.compare_comply.v1.model.ConvertToHtmlOptions;
2929
import com.ibm.watson.compare_comply.v1.model.CreateBatchOptions;
3030
import com.ibm.watson.compare_comply.v1.model.DeleteFeedbackOptions;
@@ -622,6 +622,14 @@ public void testClassifyElements() throws FileNotFoundException, InterruptedExce
622622
response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getLocation().getBegin());
623623
assertEquals(END,
624624
response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getLocation().getEnd());
625+
assertEquals(CELL_ID, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getCellId());
626+
assertEquals(BEGIN, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getLocation().getBegin());
627+
assertEquals(END, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getLocation().getEnd());
628+
assertEquals(TEXT, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getText());
629+
assertEquals(CELL_ID, response.getTables().get(0).getKeyValuePairs().get(0).getValue().getCellId());
630+
assertEquals(BEGIN, response.getTables().get(0).getKeyValuePairs().get(0).getValue().getLocation().getBegin());
631+
assertEquals(END, response.getTables().get(0).getKeyValuePairs().get(0).getValue().getLocation().getEnd());
632+
assertEquals(TEXT, response.getTables().get(0).getKeyValuePairs().get(0).getValue().getText());
625633
assertEquals(TEXT, response.getDocumentStructure().getSectionTitles().get(0).getText());
626634
assertEquals(BEGIN, response.getDocumentStructure().getSectionTitles().get(0).getLocation().getBegin());
627635
assertEquals(END, response.getDocumentStructure().getSectionTitles().get(0).getLocation().getEnd());
@@ -657,6 +665,10 @@ public void testClassifyElements() throws FileNotFoundException, InterruptedExce
657665
assertEquals(BEGIN, response.getTerminationDates().get(0).getLocation().getBegin());
658666
assertEquals(END, response.getTerminationDates().get(0).getLocation().getEnd());
659667
assertEquals(TerminationDates.ConfidenceLevel.HIGH, response.getTerminationDates().get(0).getConfidenceLevel());
668+
assertEquals(TEXT, response.getContractType().get(0).getText());
669+
assertEquals(BEGIN, response.getContractType().get(0).getLocation().getBegin());
670+
assertEquals(END, response.getContractType().get(0).getLocation().getEnd());
671+
assertEquals(ContractType.ConfidenceLevel.HIGH, response.getContractType().get(0).getConfidenceLevel());
660672
}
661673

662674
@Test
@@ -728,6 +740,14 @@ public void testExtractTables() throws FileNotFoundException, InterruptedExcepti
728740
response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getLocation().getBegin());
729741
assertEquals(END,
730742
response.getTables().get(0).getBodyCells().get(0).getAttributes().get(0).getLocation().getEnd());
743+
assertEquals(CELL_ID, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getCellId());
744+
assertEquals(BEGIN, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getLocation().getBegin());
745+
assertEquals(END, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getLocation().getEnd());
746+
assertEquals(TEXT, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getText());
747+
assertEquals(CELL_ID, response.getTables().get(0).getKeyValuePairs().get(0).getValue().getCellId());
748+
assertEquals(BEGIN, response.getTables().get(0).getKeyValuePairs().get(0).getValue().getLocation().getBegin());
749+
assertEquals(END, response.getTables().get(0).getKeyValuePairs().get(0).getValue().getLocation().getEnd());
750+
assertEquals(TEXT, response.getTables().get(0).getKeyValuePairs().get(0).getValue().getText());
731751
}
732752

733753
@Test

‎compare-comply/src/test/resources/compare_comply/classify-return.json‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,26 @@
155155
}
156156
]
157157
}
158+
],
159+
"key_value_pairs": [
160+
{
161+
"key": {
162+
"cell_id": "cell_id",
163+
"location": {
164+
"begin": 0,
165+
"end": 1
166+
},
167+
"text": "text"
168+
},
169+
"value": {
170+
"cell_id": "cell_id",
171+
"location": {
172+
"begin": 0,
173+
"end": 1
174+
},
175+
"text": "text"
176+
}
177+
}
158178
]
159179
}
160180
],
@@ -242,5 +262,15 @@
242262
},
243263
"confidence_level": "High"
244264
}
265+
],
266+
"contract_type": [
267+
{
268+
"text": "text",
269+
"location": {
270+
"begin": 0,
271+
"end": 1
272+
},
273+
"confidence_level": "High"
274+
}
245275
]
246276
}

‎compare-comply/src/test/resources/compare_comply/table-return.json‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,26 @@
116116
}
117117
]
118118
}
119+
],
120+
"key_value_pairs": [
121+
{
122+
"key": {
123+
"cell_id": "cell_id",
124+
"location": {
125+
"begin": 0,
126+
"end": 1
127+
},
128+
"text": "text"
129+
},
130+
"value": {
131+
"cell_id": "cell_id",
132+
"location": {
133+
"begin": 0,
134+
"end": 1
135+
},
136+
"text": "text"
137+
}
138+
}
119139
]
120140
}
121141
]

0 commit comments

Comments
 (0)