Skip to content

Commit 864f8e9

Browse files
author
Grace Calianese
committed
update failing test
1 parent a19354b commit 864f8e9

2 files changed

Lines changed: 80 additions & 19 deletions

File tree

api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -233,22 +233,52 @@ void testMatchRecord(String testFilename, String responseStr, int statusCode) th
233233
}
234234
}
235235

236-
// private static Stream<Arguments> testMatchRecordMissingFieldParameters() throws IOException {
237-
// return getTestFiles("-record-similarity-missing-field.json");
238-
// }
239-
240-
// @ParameterizedTest(name = "testFilename: {0}; statusCode: {2}")
241-
// @MethodSource("testMatchRecordMissingFieldParameters")
242-
// void testMatchRecordMissingField(String testFilename, String responseStr, int statusCode) throws IOException {
243-
// setStatusCodeResponse(responseStr, statusCode);
244-
//
245-
// try {
246-
// readValueRecordMatcher(testFilename);
247-
// fail("Did not throw exception for a field type in request but not in mapping");
248-
// } catch (IllegalArgumentException e) {
249-
// assertEquals("Unsupported field name: primaryName not found in field mapping", e.getMessage());
250-
// }
251-
// }
236+
private static Stream<Arguments> testMatchRecordMissingFieldParameters() throws IOException {
237+
return getTestFiles("-record-similarity-missing-field.json");
238+
}
239+
240+
@ParameterizedTest(name = "testFilename: {0}; statusCode: {2}")
241+
@MethodSource("testMatchRecordMissingFieldParameters")
242+
void testMatchRecordMissingField(String testFilename, String responseStr, int statusCode) throws IOException {
243+
setStatusCodeResponse(responseStr, statusCode);
244+
readValueRecordMatcher(testFilename);
245+
assertEquals("{\n" +
246+
" \"results\": [\n" +
247+
" {\n" +
248+
" \"score\": 0.0,\n" +
249+
" \"left\": {\n" +
250+
" \"dob2\": \"1993/04/16\",\n" +
251+
" \"dob\": \"1993-04-16\",\n" +
252+
" \"primaryName\": {\n" +
253+
" \"data\": \"Ethan R\",\n" +
254+
" \"language\": \"eng\",\n" +
255+
" \"entityType\": \"PERSON\"\n" +
256+
" },\n" +
257+
" \"addr\": \"123 Roadlane Ave\"\n" +
258+
" },\n" +
259+
" \"right\": {\n" +
260+
" \"dob\": \"1993-04-16\",\n" +
261+
" \"primaryName\": \"Seth R\"\n" +
262+
" },\n" +
263+
" \"error\": \"Field 'primaryName' not found in field mapping\"\n" +
264+
" },\n" +
265+
" {\n" +
266+
" \"score\": 0.0,\n" +
267+
" \"left\": {\n" +
268+
" \"dob\": \"1993-04-16\",\n" +
269+
" \"primaryName\": \"Evan R\"\n" +
270+
" },\n" +
271+
" \"right\": {\n" +
272+
" \"dob2\": \"1993/04/16\",\n" +
273+
" \"dob\": \"1993-04-16\",\n" +
274+
" \"primaryName\": \"Ivan R\",\n" +
275+
" \"addr\": \"123 Roadlane Ave\"\n" +
276+
" },\n" +
277+
" \"error\": \"Field 'primaryName' not found in field mapping\"\n" +
278+
" }\n" +
279+
" ]\n" +
280+
"}", responseStr);
281+
}
252282

253283
private static Stream<Arguments> testMatchRecordNullFieldParameters() throws IOException {
254284
return getTestFiles("-record-similarity-null-field.json");
Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
{
2-
"code": "badRequestFormat",
3-
"message": "Unsupported field name: primaryName not found in field mapping",
4-
"stack": null
2+
"results": [
3+
{
4+
"score": 0.0,
5+
"left": {
6+
"dob2": "1993/04/16",
7+
"dob": "1993-04-16",
8+
"primaryName": {
9+
"data": "Ethan R",
10+
"language": "eng",
11+
"entityType": "PERSON"
12+
},
13+
"addr": "123 Roadlane Ave"
14+
},
15+
"right": {
16+
"dob": "1993-04-16",
17+
"primaryName": "Seth R"
18+
},
19+
"error": "Field 'primaryName' not found in field mapping"
20+
},
21+
{
22+
"score": 0.0,
23+
"left": {
24+
"dob": "1993-04-16",
25+
"primaryName": "Evan R"
26+
},
27+
"right": {
28+
"dob2": "1993/04/16",
29+
"dob": "1993-04-16",
30+
"primaryName": "Ivan R",
31+
"addr": "123 Roadlane Ave"
32+
},
33+
"error": "Field 'primaryName' not found in field mapping"
34+
}
35+
]
536
}

0 commit comments

Comments
 (0)