@@ -171,18 +171,17 @@ void serializeFacetFilters() throws IOException {
171
171
@ ValueSource (strings = {"facetFilters" , "optionalFilters" , "tagFilters" , "numericFilters" })
172
172
void testLegacyFiltersFormat (String input ) throws IOException {
173
173
174
- // Testing "one string" legacy filters => should be converted to "ORED" nested filters
175
- // [["color:green", "color:yellow"]]
174
+ // Testing "one string" legacy filters => should be converted to "ANDED" filters
175
+ // [["color:green"],[ "color:yellow"]]
176
176
String stringFilters = String .format ("{\" %s\" :\" color:green,color:yellow\" }" , input );
177
-
178
- assertOREDResult (
177
+ assertANDEDListResult (
179
178
extractFilters (
180
179
Defaults .getObjectMapper ().readValue (stringFilters , ConsequenceParams .class ), input ));
181
180
182
- // Testing "one array" legacy filters => should be converted to "ORED" nested filters
183
- // [["color:green", "color:yellow"]]
181
+ // Testing "one array" legacy filters => should be converted to "ANDED" filters
182
+ // [["color:green"],[ "color:yellow"]]
184
183
String arrayFilters = String .format ("{\" %s\" :[\" color:green\" ,\" color:yellow\" ]}" , input );
185
- assertOREDResult (
184
+ assertANDEDListResult (
186
185
extractFilters (
187
186
Defaults .getObjectMapper ().readValue (arrayFilters , ConsequenceParams .class ), input ));
188
187
@@ -193,8 +192,17 @@ void testLegacyFiltersFormat(String input) throws IOException {
193
192
Defaults .getObjectMapper ().readValue (nestedArrayFilters , ConsequenceParams .class ),
194
193
input ));
195
194
195
+ // Testing "one string with parenthesis" legacy filters => should be converted to "ORED" filters
196
+ // [["color:green", "color:yellow"], ["color:blue"]]
197
+ String stringParenthesisFilters =
198
+ String .format ("{\" %s\" :\" (color:green,color:yellow),color:blue\" }" , input );
199
+ assertOREDLatestResult (
200
+ extractFilters (
201
+ Defaults .getObjectMapper ().readValue (stringParenthesisFilters , ConsequenceParams .class ),
202
+ input ));
203
+
196
204
// Testing mixed case with array and string
197
- // [["color:green","color:yellow"],"color:blue"]
205
+ // [["color:green","color:yellow"], [ "color:blue"] ]
198
206
String stringAndArrayFilters =
199
207
String .format ("{\" %s\" :[[\" color:green\" ,\" color:yellow\" ],\" color:blue\" ]}" , input );
200
208
List <List <String >> mixedDeserialized =
@@ -242,6 +250,14 @@ void assertOREDResult(List<List<String>> result) {
242
250
assertThat (result .get (0 )).containsSequence ("color:yellow" );
243
251
}
244
252
253
+ void assertANDEDListResult (List <List <String >> result ) {
254
+ assertThat (result ).hasSize (2 );
255
+ assertThat (result .get (0 )).hasSize (1 );
256
+ assertThat (result .get (0 )).containsSequence ("color:green" );
257
+ assertThat (result .get (1 )).hasSize (1 );
258
+ assertThat (result .get (1 )).containsSequence ("color:yellow" );
259
+ }
260
+
245
261
void assertOREDLatestResult (List <List <String >> result ) {
246
262
assertThat (result ).hasSize (2 );
247
263
assertThat (result .get (0 )).hasSize (2 );
0 commit comments