You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2025/06/20 01:57:22 UTC

(shardingsphere) branch master updated: Refactor SelectStatementContextTest (#35757)

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 0b285953405 Refactor SelectStatementContextTest (#35757)
0b285953405 is described below

commit 0b28595340516d0af7edfe6b88ed0ea57c15757c
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Fri Jun 20 09:57:16 2025 +0800

    Refactor SelectStatementContextTest (#35757)
    
    * Add more assertions on RowNumberDecoratorMergedResultTest
    
    * Refactor SelectStatementContextTest
---
 .../context/statement/type/dml/SelectStatementContextTest.java     | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/type/dml/SelectStatementContextTest.java b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/type/dml/SelectStatementContextTest.java
index 2d637afe53a..1515af53cc8 100644
--- a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/type/dml/SelectStatementContextTest.java
+++ b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/type/dml/SelectStatementContextTest.java
@@ -202,6 +202,7 @@ class SelectStatementContextTest {
         SelectStatement selectStatement = new SelectStatement();
         WhereSegment whereSegment = mock(WhereSegment.class, RETURNS_DEEP_STUBS);
         selectStatement.setWhere(whereSegment);
+        when(whereSegment.getExpr().getText()).thenReturn("");
         ShardingSphereDatabase database = mockDatabase();
         selectStatement.setProjections(new ProjectionsSegment(0, 0));
         SelectStatementContext actual =
@@ -215,7 +216,9 @@ class SelectStatementContextTest {
     @Test
     void assertContainsSubquery() {
         SelectStatement subSelectStatement = new SelectStatement();
-        WhereSegment whereSegment = new WhereSegment(0, 0, mock(BinaryOperationExpression.class, RETURNS_DEEP_STUBS));
+        BinaryOperationExpression binaryOperationExpression = mock(BinaryOperationExpression.class, RETURNS_DEEP_STUBS);
+        when(binaryOperationExpression.getText()).thenReturn("");
+        WhereSegment whereSegment = new WhereSegment(0, 0, binaryOperationExpression);
         subSelectStatement.setWhere(whereSegment);
         ProjectionsSegment subqueryProjections = new ProjectionsSegment(0, 0);
         subqueryProjections.getProjections().add(new ColumnProjectionSegment(new ColumnSegment(0, 0, new IdentifierValue("order_id"))));
@@ -235,7 +238,7 @@ class SelectStatementContextTest {
         SelectStatement subSelectStatement = new SelectStatement();
         ColumnSegment left = new ColumnSegment(0, 10, new IdentifierValue("id"));
         LiteralExpressionSegment right = new LiteralExpressionSegment(0, 0, 20);
-        BinaryOperationExpression expression = new BinaryOperationExpression(0, 0, left, right, "=", null);
+        BinaryOperationExpression expression = new BinaryOperationExpression(0, 0, left, right, "=", "");
         WhereSegment subWhereSegment = new WhereSegment(0, 0, expression);
         subSelectStatement.setWhere(subWhereSegment);
         ProjectionsSegment subqueryProjections = new ProjectionsSegment(0, 0);