@@ -43,15 +43,15 @@ class RecordSimilarityRequestTest {
4343 private static final ObjectMapper MAPPER = ApiModelMixinModule .setupObjectMapper (new ObjectMapper ());
4444
4545 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\" }}]}}" ;
46- 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} ,\" 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\" }}]}, \" parameters \" :{ \" timeDistanceWeight \" : \" 0.8 \" , \" stringDistanceWeight \" : \" 0.1 \" }}" ;
47- 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},\" 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\" }}]}, \" parameterUniverse \" : \" myUniverse \" }" ;
46+ 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\" :{\" address\" :\" 123 Roadlane Ave\" }}]}}" ;
47+ 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\" :{\" address\" :\" 123 Roadlane Ave\" }}]}}" ;
4848
4949 private static final RecordSimilarityRequest EXPECTED_REQUEST = RecordSimilarityRequest .builder ()
5050 .fields (Map .of (
51+ "addr" , RecordSimilarityFieldInfo .builder ().type (RecordFieldType .ADDRESS ).weight (0.5 ).build (),
5152 "dob2" , RecordSimilarityFieldInfo .builder ().type (RecordFieldType .DATE ).weight (0.1 ).build (),
5253 "primaryName" , RecordSimilarityFieldInfo .builder ().type (RecordFieldType .NAME ).weight (0.5 ).build (),
53- "dob" , RecordSimilarityFieldInfo .builder ().type (RecordFieldType .DATE ).weight (0.2 ).build (),
54- "addr" , RecordSimilarityFieldInfo .builder ().type (RecordFieldType .ADDRESS ).weight (0.5 ).build ()))
54+ "dob" , RecordSimilarityFieldInfo .builder ().type (RecordFieldType .DATE ).weight (0.2 ).build ()))
5555 .properties (RecordSimilarityProperties .builder ().threshold (0.7 ).includeExplainInfo (true ).build ())
5656 .records (RecordSimilarityRecords .builder ()
5757 .left (
@@ -94,7 +94,16 @@ class RecordSimilarityRequestTest {
9494 "primaryName" , RecordSimilarityFieldInfo .builder ().type (RecordFieldType .NAME ).weight (0.5 ).build (),
9595 "dob" , RecordSimilarityFieldInfo .builder ().type (RecordFieldType .DATE ).weight (0.2 ).build (),
9696 "addr" , RecordSimilarityFieldInfo .builder ().type (RecordFieldType .ADDRESS ).weight (0.5 ).build ()))
97- .properties (RecordSimilarityProperties .builder ().threshold (0.7 ).includeExplainInfo (true ).build ())
97+ .properties (RecordSimilarityProperties .builder ()
98+ .threshold (0.7 )
99+ .includeExplainInfo (true )
100+ .parameters (
101+ Map .of (
102+ "timeDistanceWeight" , "0.8" ,
103+ "stringDistanceWeight" , "0.1"
104+ )
105+ )
106+ .build ())
98107 .records (RecordSimilarityRecords .builder ()
99108 .left (
100109 List .of (
@@ -128,19 +137,19 @@ class RecordSimilarityRequestTest {
128137 )
129138 )
130139 ).build ()
131- )
132- .parameters (Map .of (
133- "timeDistanceWeight" , "0.8" ,
134- "stringDistanceWeight" , "0.1" ))
135- .build ();
140+ ).build ();
136141
137142 private static final RecordSimilarityRequest EXPECTED_REQUEST_WITH_UNIVERSE = RecordSimilarityRequest .builder ()
138143 .fields (Map .of (
139144 "dob" , RecordSimilarityFieldInfo .builder ().type (RecordFieldType .DATE ).weight (0.2 ).build (),
140145 "primaryName" , RecordSimilarityFieldInfo .builder ().type (RecordFieldType .NAME ).weight (0.5 ).build (),
141146 "dob2" , RecordSimilarityFieldInfo .builder ().type (RecordFieldType .DATE ).weight (0.1 ).build (),
142147 "addr" , RecordSimilarityFieldInfo .builder ().type (RecordFieldType .ADDRESS ).weight (0.5 ).build ()))
143- .properties (RecordSimilarityProperties .builder ().threshold (0.7 ).includeExplainInfo (true ).build ())
148+ .properties (RecordSimilarityProperties .builder ()
149+ .threshold (0.7 )
150+ .includeExplainInfo (true )
151+ .parameterUniverse ("myParameterUniverse" )
152+ .build ())
144153 .records (RecordSimilarityRecords .builder ()
145154 .left (
146155 List .of (
@@ -174,8 +183,7 @@ class RecordSimilarityRequestTest {
174183 )
175184 )
176185 ).build ()
177- )
178- .parameterUniverse ("myUniverse" ).build ();
186+ ).build ();
179187
180188 @ Test
181189 void testDeserialization () throws JsonProcessingException {
0 commit comments