This is an automated email from the ASF dual-hosted git repository.
jianglongtao 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 031cc39ef36 Add more test cases on
BroadcastRuleConfigurationToDistSQLConverter (#33457)
031cc39ef36 is described below
commit 031cc39ef360b8bc1fbee512cb07e815977f486b
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Oct 29 22:20:36 2024 +0800
Add more test cases on BroadcastRuleConfigurationToDistSQLConverter (#33457)
---
.../BroadcastRuleConfigurationToDistSQLConverterTest.java | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git
a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/converter/BroadcastRuleConfigurationToDistSQLConverterTest.java
b/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/converter/BroadcastRuleConfigurationToDistSQLConverterTest.java
index 0cf40f1f14c..26d8e7c2b60 100644
---
a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/converter/BroadcastRuleConfigurationToDistSQLConverterTest.java
+++
b/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/converter/BroadcastRuleConfigurationToDistSQLConverterTest.java
@@ -23,21 +23,25 @@ import
org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
+import java.util.Collections;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
class BroadcastRuleConfigurationToDistSQLConverterTest {
@SuppressWarnings("unchecked")
private final
RuleConfigurationToDistSQLConverter<BroadcastRuleConfiguration> converter =
TypedSPILoader.getService(RuleConfigurationToDistSQLConverter.class,
BroadcastRuleConfiguration.class);
+ @Test
+ void assertConvertWithEmptyTables() {
+ BroadcastRuleConfiguration ruleConfig = new
BroadcastRuleConfiguration(Collections.emptyList());
+ assertThat(converter.convert(ruleConfig), is(""));
+ }
+
@Test
void assertConvert() {
- BroadcastRuleConfiguration ruleConfig =
mock(BroadcastRuleConfiguration.class);
- when(ruleConfig.getTables()).thenReturn(Arrays.asList("t_province",
"t_city"));
- assertThat(converter.convert(ruleConfig), is("CREATE BROADCAST TABLE
RULE t_province,t_city;"));
+ BroadcastRuleConfiguration ruleConfig = new
BroadcastRuleConfiguration(Arrays.asList("foo_tbl", "bar_tbl"));
+ assertThat(converter.convert(ruleConfig), is("CREATE BROADCAST TABLE
RULE foo_tbl,bar_tbl;"));
}
}