You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2022/07/25 11:28:33 UTC

[shardingsphere] branch master updated: Refactor InsertCipherNameTokenGeneratorTest (#19528)

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 9887ddf0620 Refactor InsertCipherNameTokenGeneratorTest (#19528)
9887ddf0620 is described below

commit 9887ddf0620a3280581f71f4702497d47692883c
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Mon Jul 25 19:28:27 2022 +0800

    Refactor InsertCipherNameTokenGeneratorTest (#19528)
---
 .../token/generator/InsertCipherNameTokenGeneratorTest.java      | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/InsertCipherNameTokenGeneratorTest.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/InsertCipherNameTokenGeneratorTest.java
index b3b38248f53..6c0d505cde6 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/InsertCipherNameTokenGeneratorTest.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/test/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/InsertCipherNameTokenGeneratorTest.java
@@ -22,22 +22,20 @@ import org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementConte
 import org.junit.Before;
 import org.junit.Test;
 
-import java.util.Collection;
 import java.util.Collections;
 
 import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.mock;
 
 public final class InsertCipherNameTokenGeneratorTest extends EncryptGeneratorBaseTest {
     
-    private InsertCipherNameTokenGenerator generator;
+    private final InsertCipherNameTokenGenerator generator = new InsertCipherNameTokenGenerator();
     
     @Before
     public void setup() {
-        generator = new InsertCipherNameTokenGenerator();
         generator.setEncryptRule(new EncryptRule(createEncryptRuleConfiguration()));
     }
     
@@ -53,7 +51,6 @@ public final class InsertCipherNameTokenGeneratorTest extends EncryptGeneratorBa
     
     @Test
     public void assertGenerateSQLTokensWithInsertStatementContext() {
-        Collection<?> tokens = generator.generateSQLTokens(createInsertStatementContext(Collections.emptyList()));
-        assertThat(tokens.size(), is(1));
+        assertThat(generator.generateSQLTokens(createInsertStatementContext(Collections.emptyList())).size(), is(1));
     }
 }