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 d9ce047d51d Fix sonar issue on
CreateBroadcastTableRuleStatementUpdaterTest (#26405)
d9ce047d51d is described below
commit d9ce047d51d057cd8639f43f64642cb91b2dffbe
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Jun 18 09:21:32 2023 +0800
Fix sonar issue on CreateBroadcastTableRuleStatementUpdaterTest (#26405)
---
.../update/CreateBroadcastTableRuleStatementUpdaterTest.java | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git
a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleStatementUpdaterTest.java
b/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleStatementUpdaterTest.java
index fd4c4ad9b6a..6bac1416f0a 100644
---
a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleStatementUpdaterTest.java
+++
b/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleStatementUpdaterTest.java
@@ -22,8 +22,6 @@ import
org.apache.shardingsphere.broadcast.distsql.parser.statement.CreateBroadc
import
org.apache.shardingsphere.distsql.handler.exception.rule.DuplicateRuleException;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.junit.jupiter.api.Test;
-import org.mockito.Answers;
-import org.mockito.Mock;
import java.util.Collections;
import java.util.LinkedList;
@@ -36,9 +34,6 @@ import static org.mockito.Mockito.when;
class CreateBroadcastTableRuleStatementUpdaterTest {
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- private ShardingSphereDatabase database;
-
private final CreateBroadcastTableRuleStatementUpdater updater = new
CreateBroadcastTableRuleStatementUpdater();
@Test
@@ -46,14 +41,14 @@ class CreateBroadcastTableRuleStatementUpdaterTest {
BroadcastRuleConfiguration currentConfiguration =
mock(BroadcastRuleConfiguration.class);
when(currentConfiguration.getTables()).thenReturn(Collections.singleton("t_address"));
CreateBroadcastTableRuleStatement statement = new
CreateBroadcastTableRuleStatement(false, Collections.singleton("t_address"));
- assertThrows(DuplicateRuleException.class, () ->
updater.checkSQLStatement(database, statement, currentConfiguration));
+ assertThrows(DuplicateRuleException.class, () ->
updater.checkSQLStatement(mock(ShardingSphereDatabase.class), statement,
currentConfiguration));
}
@Test
void assertBuildToBeCreatedRuleConfiguration() {
BroadcastRuleConfiguration currentConfig = new
BroadcastRuleConfiguration(new LinkedList<>());
CreateBroadcastTableRuleStatement statement = new
CreateBroadcastTableRuleStatement(false, Collections.singleton("t_address"));
- updater.checkSQLStatement(database, statement, currentConfig);
+ updater.checkSQLStatement(mock(ShardingSphereDatabase.class),
statement, currentConfig);
BroadcastRuleConfiguration toBeCreatedRuleConfig =
updater.buildToBeCreatedRuleConfiguration(currentConfig, statement);
updater.updateCurrentRuleConfiguration(currentConfig,
toBeCreatedRuleConfig);
assertThat(currentConfig.getTables().size(), is(1));