This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 66f393420f6 Refactor assertCreateEncryptRuleWithIfNotExists unit test
(#30790)
66f393420f6 is described below
commit 66f393420f6b9a633af41b42ce775b75fbde6e6d
Author: zhaojinchao <[email protected]>
AuthorDate: Sat Apr 6 19:55:05 2024 +0800
Refactor assertCreateEncryptRuleWithIfNotExists unit test (#30790)
---
.../distsql/handler/update/CreateEncryptRuleExecutorTest.java | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git
a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutorTest.java
b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutorTest.java
index 64ae09a71ed..04f7a428501 100644
---
a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutorTest.java
+++
b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutorTest.java
@@ -42,7 +42,7 @@ import java.util.LinkedList;
import java.util.Properties;
import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -79,15 +79,11 @@ class CreateEncryptRuleExecutorTest {
@Test
void assertCreateEncryptRuleWithIfNotExists() {
- EncryptRuleConfiguration currentRuleConfig = getCurrentRuleConfig();
- EncryptRule rule = mock(EncryptRule.class);
- when(rule.getConfiguration()).thenReturn(currentRuleConfig);
- executor.setRule(rule);
CreateEncryptRuleStatement sqlStatement =
createAESEncryptRuleSQLStatement(true);
executor.checkBeforeUpdate(sqlStatement);
EncryptRuleConfiguration toBeCreatedRuleConfig =
executor.buildToBeCreatedRuleConfiguration(sqlStatement);
- assertTrue(toBeCreatedRuleConfig.getTables().isEmpty());
- assertTrue(toBeCreatedRuleConfig.getEncryptors().isEmpty());
+ assertFalse(toBeCreatedRuleConfig.getTables().isEmpty());
+ assertFalse(toBeCreatedRuleConfig.getEncryptors().isEmpty());
}
private CreateEncryptRuleStatement createAESEncryptRuleSQLStatement(final
boolean ifNotExists) {