Skip to content

Commit dbc8a9a

Browse files
authored
Remove redundant database type mocks (#35490)
* Add DistSQLExecutorDatabaseAware interface to ShowShardingTableNodesExecutor * Refactor SetTransactionHandler * Remove redundant database type mocks - Remove unnecessary database type mocking from FetchStreamMergedResultTest and ShardingDDLResultMergerTest - This change simplifies the test setup by removing redundant mock configurations
1 parent 039356f commit dbc8a9a

File tree

2 files changed

+0
-3
lines changed

2 files changed

+0
-3
lines changed

features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/ddl/ShardingDDLResultMergerTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ private SelectStatement createSelectStatement() {
9797
SelectStatement result = mock(SelectStatement.class, RETURNS_DEEP_STUBS);
9898
when(result.getFrom()).thenReturn(Optional.of(new SimpleTableSegment(new TableNameSegment(10, 13, new IdentifierValue("tbl")))));
9999
when(result.getProjections()).thenReturn(new ProjectionsSegment(0, 0));
100-
when(result.getDatabaseType()).thenReturn(databaseType);
101100
return result;
102101
}
103102

features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/ddl/fetch/FetchStreamMergedResultTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ private static CursorStatementContext mockCursorStatementContext() {
110110
CursorStatement cursorStatement = mock(CursorStatement.class);
111111
SelectStatement selectStatement = mockSelectStatement();
112112
when(cursorStatement.getSelect()).thenReturn(selectStatement);
113-
when(cursorStatement.getDatabaseType()).thenReturn(DATABASE_TYPE);
114113
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
115114
when(database.getName()).thenReturn("foo_db");
116115
return new CursorStatementContext(new ShardingSphereMetaData(Collections.singleton(database), mock(), mock(), mock()), Collections.emptyList(), cursorStatement, "foo_db");
@@ -120,7 +119,6 @@ private static SelectStatement mockSelectStatement() {
120119
SelectStatement result = mock(SelectStatement.class);
121120
when(result.getProjections()).thenReturn(new ProjectionsSegment(0, 0));
122121
when(result.getFrom()).thenReturn(Optional.of(new SimpleTableSegment(new TableNameSegment(0, 0, new IdentifierValue("foo_tbl")))));
123-
when(result.getDatabaseType()).thenReturn(DATABASE_TYPE);
124122
return result;
125123
}
126124

0 commit comments

Comments
 (0)