This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new ac9db400057 Add more test cases on EncryptInCondition (#33621)
ac9db400057 is described below
commit ac9db400057e85ec13c083ec3d60f4e3f39e2927
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Nov 12 12:02:33 2024 +0800
Add more test cases on EncryptInCondition (#33621)
---
.../rewrite/condition/impl/EncryptInConditionTest.java | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/condition/impl/EncryptInConditionTest.java
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/condition/impl/EncryptInConditionTest.java
index bcf53ee6679..7c366788b02 100644
---
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/condition/impl/EncryptInConditionTest.java
+++
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/condition/impl/EncryptInConditionTest.java
@@ -19,23 +19,26 @@ package
org.apache.shardingsphere.encrypt.rewrite.condition.impl;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.ExpressionSegment;
import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.simple.LiteralExpressionSegment;
+import
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.simple.ParameterMarkerExpressionSegment;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.mockito.Mockito.mock;
class EncryptInConditionTest {
@Test
- void assertGetConditionValues() {
- List<ExpressionSegment> expressions = Arrays.asList(new
LiteralExpressionSegment(0, 0, 1), new LiteralExpressionSegment(0, 0, 2));
- List<Object> actual = new EncryptInCondition("col", null, 0, 0,
expressions).getValues(Collections.emptyList());
- assertThat(actual.size(), is(2));
- assertThat(actual.get(0), is(1));
- assertThat(actual.get(1), is(2));
+ void assertGetValues() {
+ List<ExpressionSegment> expressions = Arrays.asList(new
ParameterMarkerExpressionSegment(0, 0, 0), new LiteralExpressionSegment(0, 0,
1),
+ new ParameterMarkerExpressionSegment(0, 0, 1),
mock(ExpressionSegment.class));
+ List<Object> actual = new EncryptInCondition("foo_col", null, 0, 0,
expressions).getValues(Arrays.asList("foo", "bar"));
+ assertThat(actual.size(), is(3));
+ assertThat(actual.get(0), is("foo"));
+ assertThat(actual.get(1), is(1));
+ assertThat(actual.get(2), is("bar"));
}
}