2929import com .basistech .util .LanguageCode ;
3030import com .fasterxml .jackson .core .JsonProcessingException ;
3131import com .fasterxml .jackson .core .type .TypeReference ;
32+ import com .fasterxml .jackson .databind .JsonNode ;
3233import com .fasterxml .jackson .databind .ObjectMapper ;
3334import org .junit .jupiter .api .Test ;
3435
@@ -44,7 +45,6 @@ class RecordSimilarityRequestTest {
4445 private static final String EXPECTED_JSON_WITH_PARAMS = "{\" fields\" :{\" dob2\" :{\" type\" :\" rni_date\" ,\" weight\" :0.1},\" primaryName\" :{\" type\" :\" rni_name\" ,\" weight\" :0.5},\" dob\" :{\" type\" :\" rni_date\" ,\" weight\" :0.2},\" addr\" :{\" type\" :\" rni_address\" ,\" weight\" :0.5}},\" properties\" :{\" threshold\" :0.7,\" includeExplainInfo\" :true,\" parameters\" :{\" timeDistanceWeight\" :\" 0.8\" ,\" stringDistanceWeight\" :\" 0.1\" }},\" records\" :{\" left\" :[{\" dob2\" :{\" date\" :\" 1993/04/16\" },\" primaryName\" :{\" text\" :\" Ethan R\" ,\" entityType\" :\" PERSON\" ,\" language\" :\" eng\" ,\" languageOfOrigin\" :\" eng\" ,\" script\" :\" Latn\" },\" dob\" :\" 1993-04-16\" ,\" addr\" :\" 123 Roadlane Ave\" },{\" primaryName\" :{\" text\" :\" Evan R\" },\" dob\" :{\" date\" :\" 1993-04-16\" }}],\" right\" :[{\" primaryName\" :{\" text\" :\" Seth R\" ,\" language\" :\" eng\" },\" dob\" :{\" date\" :\" 1993-04-16\" }},{\" dob2\" :{\" date\" :\" 1993/04/16\" },\" primaryName\" :\" Ivan R\" ,\" dob\" :{\" date\" :\" 1993-04-16\" },\" addr\" :{\" houseNumber\" :\" 123\" ,\" road\" :\" Roadlane Ave\" }}]}}" ;
4546 private static final String EXPECTED_JSON_WITH_UNIVERSE = "{\" fields\" :{\" dob2\" :{\" type\" :\" rni_date\" ,\" weight\" :0.1},\" primaryName\" :{\" type\" :\" rni_name\" ,\" weight\" :0.5},\" dob\" :{\" type\" :\" rni_date\" ,\" weight\" :0.2},\" addr\" :{\" type\" :\" rni_address\" ,\" weight\" :0.5}},\" properties\" :{\" threshold\" :0.7,\" includeExplainInfo\" :true,\" parameterUniverse\" :\" myParameterUniverse\" },\" records\" :{\" left\" :[{\" dob2\" :{\" date\" :\" 1993/04/16\" },\" primaryName\" :{\" text\" :\" Ethan R\" ,\" entityType\" :\" PERSON\" ,\" language\" :\" eng\" ,\" languageOfOrigin\" :\" eng\" ,\" script\" :\" Latn\" },\" dob\" :\" 1993-04-16\" ,\" addr\" :\" 123 Roadlane Ave\" },{\" primaryName\" :{\" text\" :\" Evan R\" },\" dob\" :{\" date\" :\" 1993-04-16\" }}],\" right\" :[{\" primaryName\" :{\" text\" :\" Seth R\" ,\" language\" :\" eng\" },\" dob\" :{\" date\" :\" 1993-04-16\" }},{\" dob2\" :{\" date\" :\" 1993/04/16\" },\" primaryName\" :\" Ivan R\" ,\" dob\" :{\" date\" :\" 1993-04-16\" },\" addr\" :{\" houseNumber\" :\" 123\" ,\" road\" :\" Roadlane Ave\" }}]}}" ;
4647
47- private static final String EXPECTED_JSON = "{\" fields\" :{\" dob2\" :{\" type\" :\" rni_date\" ,\" weight\" :0.1},\" primaryName\" :{\" type\" :\" rni_name\" ,\" weight\" :0.5},\" dob\" :{\" type\" :\" rni_date\" ,\" weight\" :0.2},\" addr\" :{\" type\" :\" rni_address\" ,\" weight\" :0.5}},\" properties\" :{\" threshold\" :0.7,\" includeExplainInfo\" :true},\" records\" :{\" left\" :[{\" dob2\" :{\" date\" :\" 1993/04/16\" },\" primaryName\" :{\" text\" :\" Ethan R\" ,\" entityType\" :\" PERSON\" ,\" language\" :\" eng\" ,\" languageOfOrigin\" :\" eng\" ,\" script\" :\" Latn\" },\" dob\" :\" 1993-04-16\" ,\" addr\" :\" 123 Roadlane Ave\" },{\" primaryName\" :{\" text\" :\" Evan R\" },\" dob\" :{\" date\" :\" 1993-04-16\" }}],\" right\" :[{\" primaryName\" :{\" text\" :\" Seth R\" ,\" language\" :\" eng\" },\" dob\" :{\" date\" :\" 1993-04-16\" }},{\" dob2\" :{\" date\" :\" 1993/04/16\" },\" primaryName\" :\" Ivan R\" ,\" dob\" :{\" date\" :\" 1993-04-16\" },\" addr\" :{\" address\" :\" 123 Roadlane Ave\" }}]}}" ;
4848 private static final RecordSimilarityRequest EXPECTED_REQUEST = RecordSimilarityRequest .builder ()
4949 .fields (Map .of (
5050 "addr" , RecordSimilarityFieldInfo .builder ().type (RecordFieldType .RNI_ADDRESS ).weight (0.5 ).scoreIfNull (0.8 ).build (),
@@ -186,8 +186,6 @@ class RecordSimilarityRequestTest {
186186
187187 @ Test
188188 void testDeserialization () throws JsonProcessingException {
189- MAPPER .enable (MapperFeature .SORT_PROPERTIES_ALPHABETICALLY );
190- MAPPER .enable (SerializationFeature .ORDER_MAP_ENTRIES_BY_KEYS );
191189 final RecordSimilarityRequest request = MAPPER .readValue (EXPECTED_JSON , new TypeReference <>() { });
192190 assertEquals (EXPECTED_REQUEST , request );
193191
0 commit comments