Skip to content

Commit 79eb89b

Browse files
authored
Merge pull request #1078 from watson-developer-cloud/cnc-model-fix
Fix KeyValuePair model definition
2 parents 33f5e47 + 117d81c commit 79eb89b

File tree

4 files changed

+36
-28
lines changed

4 files changed

+36
-28
lines changed

compare-comply/src/main/java/com/ibm/watson/compare_comply/v1/model/KeyValuePair.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018 IBM Corp. All Rights Reserved.
2+
* (C) Copyright IBM Corp. 2019.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -12,6 +12,8 @@
1212
*/
1313
package com.ibm.watson.compare_comply.v1.model;
1414

15+
import java.util.List;
16+
1517
import com.ibm.cloud.sdk.core.service.model.GenericModel;
1618

1719
/**
@@ -20,7 +22,7 @@
2022
public class KeyValuePair extends GenericModel {
2123

2224
private Key key;
23-
private Value value;
25+
private List<Value> value;
2426

2527
/**
2628
* Gets the key.
@@ -36,11 +38,11 @@ public Key getKey() {
3638
/**
3739
* Gets the value.
3840
*
39-
* A value in a key-value pair.
41+
* A list of values in a key-value pair.
4042
*
4143
* @return the value
4244
*/
43-
public Value getValue() {
45+
public List<Value> getValue() {
4446
return value;
4547
}
4648
}

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -636,10 +636,11 @@ public void testClassifyElements() throws FileNotFoundException, InterruptedExce
636636
assertEquals(BEGIN, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getLocation().getBegin());
637637
assertEquals(END, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getLocation().getEnd());
638638
assertEquals(TEXT, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getText());
639-
assertEquals(CELL_ID, response.getTables().get(0).getKeyValuePairs().get(0).getValue().getCellId());
640-
assertEquals(BEGIN, response.getTables().get(0).getKeyValuePairs().get(0).getValue().getLocation().getBegin());
641-
assertEquals(END, response.getTables().get(0).getKeyValuePairs().get(0).getValue().getLocation().getEnd());
642-
assertEquals(TEXT, response.getTables().get(0).getKeyValuePairs().get(0).getValue().getText());
639+
assertEquals(CELL_ID, response.getTables().get(0).getKeyValuePairs().get(0).getValue().get(0).getCellId());
640+
assertEquals(BEGIN, response.getTables().get(0).getKeyValuePairs().get(0).getValue().get(0).getLocation()
641+
.getBegin());
642+
assertEquals(END, response.getTables().get(0).getKeyValuePairs().get(0).getValue().get(0).getLocation().getEnd());
643+
assertEquals(TEXT, response.getTables().get(0).getKeyValuePairs().get(0).getValue().get(0).getText());
643644
assertEquals(TEXT, response.getTables().get(0).getTitle().getText());
644645
assertEquals(BEGIN, response.getTables().get(0).getTitle().getLocation().getBegin());
645646
assertEquals(END, response.getTables().get(0).getTitle().getLocation().getEnd());
@@ -795,10 +796,11 @@ public void testExtractTables() throws FileNotFoundException, InterruptedExcepti
795796
assertEquals(BEGIN, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getLocation().getBegin());
796797
assertEquals(END, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getLocation().getEnd());
797798
assertEquals(TEXT, response.getTables().get(0).getKeyValuePairs().get(0).getKey().getText());
798-
assertEquals(CELL_ID, response.getTables().get(0).getKeyValuePairs().get(0).getValue().getCellId());
799-
assertEquals(BEGIN, response.getTables().get(0).getKeyValuePairs().get(0).getValue().getLocation().getBegin());
800-
assertEquals(END, response.getTables().get(0).getKeyValuePairs().get(0).getValue().getLocation().getEnd());
801-
assertEquals(TEXT, response.getTables().get(0).getKeyValuePairs().get(0).getValue().getText());
799+
assertEquals(CELL_ID, response.getTables().get(0).getKeyValuePairs().get(0).getValue().get(0).getCellId());
800+
assertEquals(BEGIN, response.getTables().get(0).getKeyValuePairs().get(0).getValue().get(0).getLocation()
801+
.getBegin());
802+
assertEquals(END, response.getTables().get(0).getKeyValuePairs().get(0).getValue().get(0).getLocation().getEnd());
803+
assertEquals(TEXT, response.getTables().get(0).getKeyValuePairs().get(0).getValue().get(0).getText());
802804
}
803805

804806
@Test

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,16 @@
166166
},
167167
"text": "text"
168168
},
169-
"value": {
170-
"cell_id": "cell_id",
171-
"location": {
172-
"begin": 0,
173-
"end": 1
174-
},
175-
"text": "text"
176-
}
169+
"value": [
170+
{
171+
"cell_id": "cell_id",
172+
"location": {
173+
"begin": 0,
174+
"end": 1
175+
},
176+
"text": "text"
177+
}
178+
]
177179
}
178180
],
179181
"title": {

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,16 @@
127127
},
128128
"text": "text"
129129
},
130-
"value": {
131-
"cell_id": "cell_id",
132-
"location": {
133-
"begin": 0,
134-
"end": 1
135-
},
136-
"text": "text"
137-
}
130+
"value": [
131+
{
132+
"cell_id": "cell_id",
133+
"location": {
134+
"begin": 0,
135+
"end": 1
136+
},
137+
"text": "text"
138+
}
139+
]
138140
}
139141
]
140142
}

0 commit comments

Comments
 (0)