Skip to content

Commit a70dba7

Browse files
committed
test: update on document query converter
Signed-off-by: Otavio Santana <[email protected]>
1 parent 5564223 commit a70dba7

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,30 @@
2020

2121
import static org.assertj.core.api.Assertions.assertThat;
2222

23-
class DocumentQueryConversorTest {
23+
class DocumentQueryConverterTest {
2424

2525
@ParameterizedTest
2626
@CsvSource(textBlock = """
27-
Max_;^Max.{1}
28-
Max%;^Max.{1,}
29-
M_x;^M.{1}x
30-
M%x;^M.{1,}x
31-
_ax;^.{1}ax
32-
%ax;^.{1,}ax
27+
Max_;^\\QM\\E\\Qa\\E\\Qx\\E.$
28+
Max%;^\\QM\\E\\Qa\\E\\Qx\\E.*$
29+
M_x;^\\QM\\E.\\Qx\\E$
30+
M%x;^\\QM\\E.*\\Qx\\E$
31+
_ax;^.\\Qa\\E\\Qx\\E$
32+
%ax;^.*\\Qa\\E\\Qx\\E$
3333
;^$
3434
""", delimiterString = ";")
3535
void shouldPrepareRegexValueSupportedByMongoDB(String rawValue, String expectedValue) {
3636
assertThat(DocumentQueryConversor.prepareRegexValue(rawValue))
3737
.as("The value should be prepared to be used in a MongoDB regex query: " +
38-
"the '_' character should matches any single character, and " +
39-
"the '%' character should matches any sequence of characters.")
38+
"the '_' character should match any single character, and " +
39+
"the '%' character should match any sequence of characters.")
4040
.isEqualTo(expectedValue);
4141
}
4242

4343
@Test
44-
void shouldReturnEmptyRegexWhenRawValueIsNull() {
44+
void shouldReturnNeverMatchingRegexWhenRawValueIsNull() {
4545
assertThat(DocumentQueryConversor.prepareRegexValue(null))
46-
.as("should return an empty regex when the raw value is null")
47-
.isEqualTo("^$");
46+
.as("should return a never-matching regex when the raw value is null")
47+
.isEqualTo("(?!)");
4848
}
4949
}

0 commit comments

Comments
 (0)