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 d9d18877499 Refactor SelectStatementBinderTest (#36307)
d9d18877499 is described below
commit d9d18877499094b1568e90d49773405bd611958f
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Aug 14 20:16:34 2025 +0800
Refactor SelectStatementBinderTest (#36307)
* Fixes pom format for binder-dialect
* Refactor SelectStatementBinderTest
---
.../binder/engine/statement/dml/SelectStatementBinderTest.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git
a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/statement/dml/SelectStatementBinderTest.java
b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/statement/dml/SelectStatementBinderTest.java
index 4b05c0c13c1..6884b2db104 100644
---
a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/statement/dml/SelectStatementBinderTest.java
+++
b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/engine/statement/dml/SelectStatementBinderTest.java
@@ -69,8 +69,8 @@ class SelectStatementBinderTest {
projections.getProjections().add(statusProjection);
SimpleTableSegment simpleTableSegment = new SimpleTableSegment(new
TableNameSegment(0, 0, new IdentifierValue("t_order")));
selectStatement.setFrom(simpleTableSegment);
- selectStatement.setWhere(mockWhereSegment());
- SelectStatement actual = new
SelectStatementBinder().bind(selectStatement, new
SQLStatementBinderContext(createMetaData(), "foo_db", new HintValueContext(),
selectStatement));
+ selectStatement.setWhere(createWhereSegment());
+ SelectStatement actual = new
SelectStatementBinder().bind(selectStatement, new
SQLStatementBinderContext(mockMetaData(), "foo_db", new HintValueContext(),
selectStatement));
assertThat(actual, not(selectStatement));
assertTrue(actual.getFrom().isPresent());
assertThat(actual.getFrom().get(), not(simpleTableSegment));
@@ -100,14 +100,14 @@ class SelectStatementBinderTest {
.getColumnBoundInfo().getOriginalTable().getValue(),
is("t_order"));
}
- private static WhereSegment mockWhereSegment() {
+ private WhereSegment createWhereSegment() {
FunctionSegment functionSegment = new FunctionSegment(0, 0, "nvl",
"nvl(status, 0)");
functionSegment.getParameters().add(new ColumnSegment(0, 0, new
IdentifierValue("status")));
functionSegment.getParameters().add(new LiteralExpressionSegment(0, 0,
0));
return new WhereSegment(0, 0, new BinaryOperationExpression(0, 0,
functionSegment, new LiteralExpressionSegment(0, 0, 0), "=", "nvl(status, 0) =
0"));
}
- private ShardingSphereMetaData createMetaData() {
+ private ShardingSphereMetaData mockMetaData() {
ShardingSphereSchema schema = mock(ShardingSphereSchema.class,
RETURNS_DEEP_STUBS);
when(schema.getTable("t_order").getAllColumns()).thenReturn(Arrays.asList(
new ShardingSphereColumn("order_id", Types.INTEGER, true,
false, false, true, false, false),