Skip to content

Commit 395e108

Browse files
committed
test: generate scenario on oracle nosql
Signed-off-by: Otavio Santana <[email protected]>
1 parent 6768888 commit 395e108

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

jnosql-oracle-nosql/src/test/java/org/eclipse/jnosql/databases/oracle/communication/OracleNoSqlLikeConverterTest.java

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,41 @@
1414
*/
1515
package org.eclipse.jnosql.databases.oracle.communication;
1616

17-
import static org.junit.jupiter.api.Assertions.*;
17+
import org.junit.jupiter.api.DisplayName;
18+
import org.junit.jupiter.api.Test;
19+
import org.junit.jupiter.params.ParameterizedTest;
20+
import org.junit.jupiter.params.provider.CsvSource;
21+
22+
import static org.assertj.core.api.Assertions.assertThat;
1823

1924
class OracleNoSqlLikeConverterTest {
2025

26+
@ParameterizedTest(name = "LIKE \"{0}\" -> pattern \"{1}\"")
27+
@CsvSource(textBlock = """
28+
%Ota%;.*\\QOta\\E.*
29+
Ota%;\\QOta\\E.*
30+
%Ota;.*\\QOta\\E
31+
Ota;\\QOta\\E
32+
Ot_;\\QOt\\E.
33+
_ta;.\\Qta\\E
34+
%t_a%;.*\\Qt\\E.\\Qa\\E.*
35+
.+;\\Q.+\\E
36+
""", delimiter = ';')
37+
@DisplayName("Converts SQL LIKE to Oracle NoSQL regex_like pattern (%, _ and literal quoting)")
38+
void shouldConvertSqlLikeToOracleNoSqlRegex(String like, String expected) {
39+
String actual = OracleNoSqlLikeConverter.convert(like);
40+
assertThat(actual).isEqualTo(expected);
41+
}
42+
43+
@Test
44+
@DisplayName("Returns empty string for null input")
45+
void shouldReturnEmptyForNull() {
46+
assertThat(OracleNoSqlLikeConverter.convert(null)).isEqualTo("");
47+
}
48+
49+
@Test
50+
@DisplayName("Returns empty string for empty input")
51+
void shouldReturnEmptyForEmptyString() {
52+
assertThat(OracleNoSqlLikeConverter.convert("")).isEqualTo("");
53+
}
2154
}

0 commit comments

Comments
 (0)