@@ -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" );
0 commit comments