You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2022/06/09 10:04:39 UTC

[shardingsphere] branch master updated: Refactor ConstraintTokenTest (#18263)

This is an automated email from the ASF dual-hosted git repository.

panjuan 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 39363f112a8 Refactor ConstraintTokenTest (#18263)
39363f112a8 is described below

commit 39363f112a881cb4bb2a24f0c3bb59bcf0c486f3
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Thu Jun 9 18:04:34 2022 +0800

    Refactor ConstraintTokenTest (#18263)
---
 .../rewrite/token/pojo/ConstraintTokenTest.java     | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/ConstraintTokenTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/ConstraintTokenTest.java
index 3e21301ecbe..59838955eaa 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/ConstraintTokenTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/ConstraintTokenTest.java
@@ -13,24 +13,17 @@ import java.util.Collections;
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
 
+import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
 import static org.mockito.Mockito.mock;
 
-public class ConstraintTokenTest {
-
+public final class ConstraintTokenTest {
+    
     @Test
-    public void assertConstraintToken() {
-        ConstraintToken constraintToken = new ConstraintToken(0, 1, new IdentifierValue("uc"), mock(SQLStatementContext.class), mock(ShardingRule.class));
-        assertThat(constraintToken.toString(getRouteUnit()), is("uc_t_order_0"));
-        assertTokenGrid(constraintToken);
-    }
-
-    private void assertTokenGrid(ConstraintToken constraintToken) {
-        assertThat(constraintToken.getStopIndex(), is(1));
-        assertThat(constraintToken.getStartIndex(), is(0));
+    public void assertToString() {
+        assertThat(new ConstraintToken(0, 1, new IdentifierValue("uc"), mock(SQLStatementContext.class, RETURNS_DEEP_STUBS), mock(ShardingRule.class)).toString(getRouteUnit()), is("uc"));
     }
-
+    
     private RouteUnit getRouteUnit() {
         return new RouteUnit(new RouteMapper("logic_db", "logic_db"), Collections.singletonList(new RouteMapper("t_order", "t_order_0")));
     }
-
-}
\ No newline at end of file
+}