You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/05/17 10:20:05 UTC

[GitHub] [shardingsphere] terrymanu commented on a diff in pull request #17652: Add test cases for default schema and global RuleConfigurationBuilderFactory .

terrymanu commented on code in PR #17652:
URL: https://github.com/apache/shardingsphere/pull/17652#discussion_r874631334


##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/global/DefaultGlobalRuleConfigurationBuilderFactoryTest.java:
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.rule.builder.global;
+
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureGlobalRuleBuilder;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureGlobalRuleConfigurationBuilder;
+import org.junit.Test;
+
+import java.util.Collections;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+public final class DefaultGlobalRuleConfigurationBuilderFactoryTest {
+    
+    @Test
+    @SuppressWarnings("rawtypes")
+    public void assertGetInstance() {
+        FixtureGlobalRuleBuilder builder = new FixtureGlobalRuleBuilder();
+        Map<GlobalRuleBuilder, DefaultGlobalRuleConfigurationBuilder> actual = DefaultGlobalRuleConfigurationBuilderFactory.getInstance(
+                Collections.singleton(builder));
+        assertNotNull(actual);
+        assertFalse(actual.isEmpty());

Review Comment:
   assert is empty is unnecessary assertion in this case, it is better to remove it



##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/global/DefaultGlobalRuleConfigurationBuilderFactoryTest.java:
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.rule.builder.global;
+
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureGlobalRuleBuilder;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureGlobalRuleConfigurationBuilder;
+import org.junit.Test;
+
+import java.util.Collections;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+public final class DefaultGlobalRuleConfigurationBuilderFactoryTest {
+    
+    @Test
+    @SuppressWarnings("rawtypes")
+    public void assertGetInstance() {
+        FixtureGlobalRuleBuilder builder = new FixtureGlobalRuleBuilder();
+        Map<GlobalRuleBuilder, DefaultGlobalRuleConfigurationBuilder> actual = DefaultGlobalRuleConfigurationBuilderFactory.getInstance(
+                Collections.singleton(builder));
+        assertNotNull(actual);

Review Comment:
   assertNotNull is unnecessary assertion in this case, it is better to remove it



##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/global/GlobalRuleBuilderFactoryTest.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.rule.builder.global;
+
+import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureGlobalRuleBuilder;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureGlobalRuleConfiguration;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+
+public final class GlobalRuleBuilderFactoryTest {
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstanceMap() {
+        FixtureGlobalRuleConfiguration configuration = new FixtureGlobalRuleConfiguration();
+        Map<RuleConfiguration, GlobalRuleBuilder> actual = GlobalRuleBuilderFactory.getInstanceMap(Collections.singletonList(configuration));
+        assertNotNull(actual);
+        assertFalse(actual.isEmpty());
+        assertTrue(actual.containsKey(configuration));
+        assertThat(actual.get(configuration), instanceOf(FixtureGlobalRuleBuilder.class));
+    }
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstancesWithoutAssignedGlobalRuleBuilderClasses() {
+        Collection<GlobalRuleBuilder> actual = GlobalRuleBuilderFactory.getInstances(Collections.emptyList());
+        assertNotNull(actual);

Review Comment:
   assertNotNull is unnecessary assertion in this case, it is better to remove it



##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/schema/SchemaRuleBuilderFactoryTest.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.rule.builder.schema;
+
+import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.fixture.TestRuleConfiguration;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureSchemaRuleBuilder;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureSchemaRuleConfiguration;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+public final class SchemaRuleBuilderFactoryTest {
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstances() {
+        Collection<SchemaRuleBuilder> actual = SchemaRuleBuilderFactory.getInstances();
+        assertNotNull(actual);

Review Comment:
   assertNotNull is unnecessary assertion in this case, it is better to remove it



##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/schema/SchemaRuleBuilderFactoryTest.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.rule.builder.schema;
+
+import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.fixture.TestRuleConfiguration;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureSchemaRuleBuilder;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureSchemaRuleConfiguration;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+public final class SchemaRuleBuilderFactoryTest {
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstances() {
+        Collection<SchemaRuleBuilder> actual = SchemaRuleBuilderFactory.getInstances();
+        assertNotNull(actual);
+        assertFalse(actual.isEmpty());
+        assertThat(actual.size(), is(2));
+    }
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstanceMap() {
+        FixtureSchemaRuleConfiguration configuration = new FixtureSchemaRuleConfiguration();
+        Map<RuleConfiguration, SchemaRuleBuilder> actual = SchemaRuleBuilderFactory.getInstanceMap(Collections.singleton(configuration));
+        assertNotNull(actual);
+        assertFalse(actual.isEmpty());
+        assertTrue(actual.containsKey(configuration));
+        assertThat(actual.get(configuration), instanceOf(FixtureSchemaRuleBuilder.class));
+    }
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstanceMapWithComparator() {
+        Collection<RuleConfiguration> ruleConfigs = new ArrayList<>(2);
+        ruleConfigs.add(new FixtureSchemaRuleConfiguration());
+        ruleConfigs.add(new TestRuleConfiguration());
+        Map<RuleConfiguration, SchemaRuleBuilder> actual = SchemaRuleBuilderFactory.getInstanceMap(ruleConfigs, Comparator.naturalOrder());
+        assertNotNull(actual);
+        assertFalse(actual.isEmpty());

Review Comment:
   assert is empty is unnecessary assertion in this case, it is better to remove it



##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/global/GlobalRuleBuilderFactoryTest.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.rule.builder.global;
+
+import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureGlobalRuleBuilder;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureGlobalRuleConfiguration;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+
+public final class GlobalRuleBuilderFactoryTest {
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstanceMap() {
+        FixtureGlobalRuleConfiguration configuration = new FixtureGlobalRuleConfiguration();
+        Map<RuleConfiguration, GlobalRuleBuilder> actual = GlobalRuleBuilderFactory.getInstanceMap(Collections.singletonList(configuration));
+        assertNotNull(actual);
+        assertFalse(actual.isEmpty());
+        assertTrue(actual.containsKey(configuration));
+        assertThat(actual.get(configuration), instanceOf(FixtureGlobalRuleBuilder.class));
+    }
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstancesWithoutAssignedGlobalRuleBuilderClasses() {
+        Collection<GlobalRuleBuilder> actual = GlobalRuleBuilderFactory.getInstances(Collections.emptyList());
+        assertNotNull(actual);
+        assertThat(actual.size(), is(1));
+        assertThat(actual.iterator().next(), instanceOf(FixtureGlobalRuleBuilder.class));
+    }
+    
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    @Test
+    public void assertGetInstancesWithAssignedGlobalRuleBuilderClasses() {
+        List<GlobalRuleBuilder> configuredBuilders = new ArrayList<>(1);
+        FixtureGlobalRuleBuilder builder = mock(FixtureGlobalRuleBuilder.class);
+        configuredBuilders.add(builder);
+        Collection<Class<GlobalRuleBuilder>> configuredBuilderClasses = configuredBuilders.stream().map(each -> (Class<GlobalRuleBuilder>) each.getClass()).collect(Collectors.toSet());
+        Collection<GlobalRuleBuilder> actual = GlobalRuleBuilderFactory.getInstances(configuredBuilderClasses);
+        assertNotNull(actual);
+        assertThat(actual.size(), is(0));

Review Comment:
   It is better to use `assertFalse(actual.isEmpty())`



##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/global/DefaultGlobalRuleConfigurationBuilderFactoryTest.java:
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.rule.builder.global;
+
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureGlobalRuleBuilder;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureGlobalRuleConfigurationBuilder;
+import org.junit.Test;
+
+import java.util.Collections;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+public final class DefaultGlobalRuleConfigurationBuilderFactoryTest {
+    
+    @Test
+    @SuppressWarnings("rawtypes")
+    public void assertGetInstance() {
+        FixtureGlobalRuleBuilder builder = new FixtureGlobalRuleBuilder();
+        Map<GlobalRuleBuilder, DefaultGlobalRuleConfigurationBuilder> actual = DefaultGlobalRuleConfigurationBuilderFactory.getInstance(
+                Collections.singleton(builder));
+        assertNotNull(actual);
+        assertFalse(actual.isEmpty());
+        assertTrue(actual.containsKey(builder));

Review Comment:
   assert contain key is unnecessary assertion in this case, it is better to remove it



##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/schema/DefaultSchemaRuleConfigurationBuilderFactoryTest.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.rule.builder.schema;
+
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureSchemaRuleBuilder;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureSchemaRuleConfigurationBuilder;
+import org.junit.Test;
+
+import java.util.Collections;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+public final class DefaultSchemaRuleConfigurationBuilderFactoryTest {
+    
+    @Test
+    @SuppressWarnings("rawtypes")
+    public void assertGetInstances() {
+        FixtureSchemaRuleBuilder builder = new FixtureSchemaRuleBuilder();
+        Map<SchemaRuleBuilder, DefaultSchemaRuleConfigurationBuilder> actual = DefaultSchemaRuleConfigurationBuilderFactory.getInstances(Collections.singleton(builder));
+        assertNotNull(actual);

Review Comment:
   assertNotNull is unnecessary assertion in this case, it is better to remove it



##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/global/GlobalRuleBuilderFactoryTest.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.rule.builder.global;
+
+import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureGlobalRuleBuilder;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureGlobalRuleConfiguration;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+
+public final class GlobalRuleBuilderFactoryTest {
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstanceMap() {
+        FixtureGlobalRuleConfiguration configuration = new FixtureGlobalRuleConfiguration();
+        Map<RuleConfiguration, GlobalRuleBuilder> actual = GlobalRuleBuilderFactory.getInstanceMap(Collections.singletonList(configuration));
+        assertNotNull(actual);

Review Comment:
   assertNotNull is unnecessary assertion in this case, it is better to remove it



##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/fixture/FixtureGlobalRuleBuilder.java:
##########
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.rule.builder.fixture;
+
+import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
+import org.apache.shardingsphere.infra.rule.builder.global.GlobalRuleBuilder;
+
+import java.util.Map;
+
+public final class FixtureGlobalRuleBuilder implements GlobalRuleBuilder<FixtureGlobalRuleConfiguration> {
+    
+    @Override
+    public FixtureGlobalRule build(final FixtureGlobalRuleConfiguration ruleConfig,
+                                   final Map<String, ShardingSphereMetaData> metaDataMap) {

Review Comment:
   The new line is unnecessary here, the previous is not long enough.



##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/fixture/FixtureGlobalRuleConfigurationBuilder.java:
##########
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.rule.builder.fixture;
+
+import org.apache.shardingsphere.infra.rule.builder.global.DefaultGlobalRuleConfigurationBuilder;
+
+public final class FixtureGlobalRuleConfigurationBuilder
+        implements
+            DefaultGlobalRuleConfigurationBuilder<FixtureGlobalRuleConfiguration, FixtureGlobalRuleBuilder> {

Review Comment:
   The new line is unnecessary here, the previous is not long enough.



##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/global/GlobalRuleBuilderFactoryTest.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.rule.builder.global;
+
+import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureGlobalRuleBuilder;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureGlobalRuleConfiguration;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+
+public final class GlobalRuleBuilderFactoryTest {
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstanceMap() {
+        FixtureGlobalRuleConfiguration configuration = new FixtureGlobalRuleConfiguration();
+        Map<RuleConfiguration, GlobalRuleBuilder> actual = GlobalRuleBuilderFactory.getInstanceMap(Collections.singletonList(configuration));
+        assertNotNull(actual);
+        assertFalse(actual.isEmpty());

Review Comment:
   assert is empty is unnecessary assertion in this case, it is better to remove it



##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/schema/DefaultSchemaRuleConfigurationBuilderFactoryTest.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.rule.builder.schema;
+
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureSchemaRuleBuilder;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureSchemaRuleConfigurationBuilder;
+import org.junit.Test;
+
+import java.util.Collections;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+public final class DefaultSchemaRuleConfigurationBuilderFactoryTest {
+    
+    @Test
+    @SuppressWarnings("rawtypes")
+    public void assertGetInstances() {
+        FixtureSchemaRuleBuilder builder = new FixtureSchemaRuleBuilder();
+        Map<SchemaRuleBuilder, DefaultSchemaRuleConfigurationBuilder> actual = DefaultSchemaRuleConfigurationBuilderFactory.getInstances(Collections.singleton(builder));
+        assertNotNull(actual);
+        assertFalse(actual.isEmpty());

Review Comment:
   assert is empty is unnecessary assertion in this case, it is better to remove it



##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/global/GlobalRuleBuilderFactoryTest.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.rule.builder.global;
+
+import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureGlobalRuleBuilder;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureGlobalRuleConfiguration;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+
+public final class GlobalRuleBuilderFactoryTest {
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstanceMap() {
+        FixtureGlobalRuleConfiguration configuration = new FixtureGlobalRuleConfiguration();
+        Map<RuleConfiguration, GlobalRuleBuilder> actual = GlobalRuleBuilderFactory.getInstanceMap(Collections.singletonList(configuration));
+        assertNotNull(actual);
+        assertFalse(actual.isEmpty());
+        assertTrue(actual.containsKey(configuration));
+        assertThat(actual.get(configuration), instanceOf(FixtureGlobalRuleBuilder.class));
+    }
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstancesWithoutAssignedGlobalRuleBuilderClasses() {
+        Collection<GlobalRuleBuilder> actual = GlobalRuleBuilderFactory.getInstances(Collections.emptyList());
+        assertNotNull(actual);
+        assertThat(actual.size(), is(1));
+        assertThat(actual.iterator().next(), instanceOf(FixtureGlobalRuleBuilder.class));
+    }
+    
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    @Test
+    public void assertGetInstancesWithAssignedGlobalRuleBuilderClasses() {
+        List<GlobalRuleBuilder> configuredBuilders = new ArrayList<>(1);
+        FixtureGlobalRuleBuilder builder = mock(FixtureGlobalRuleBuilder.class);
+        configuredBuilders.add(builder);
+        Collection<Class<GlobalRuleBuilder>> configuredBuilderClasses = configuredBuilders.stream().map(each -> (Class<GlobalRuleBuilder>) each.getClass()).collect(Collectors.toSet());
+        Collection<GlobalRuleBuilder> actual = GlobalRuleBuilderFactory.getInstances(configuredBuilderClasses);
+        assertNotNull(actual);

Review Comment:
   assertNotNull is unnecessary assertion in this case, it is better to remove it



##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/schema/SchemaRuleBuilderFactoryTest.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.rule.builder.schema;
+
+import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.fixture.TestRuleConfiguration;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureSchemaRuleBuilder;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureSchemaRuleConfiguration;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+public final class SchemaRuleBuilderFactoryTest {
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstances() {
+        Collection<SchemaRuleBuilder> actual = SchemaRuleBuilderFactory.getInstances();
+        assertNotNull(actual);
+        assertFalse(actual.isEmpty());
+        assertThat(actual.size(), is(2));
+    }
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstanceMap() {
+        FixtureSchemaRuleConfiguration configuration = new FixtureSchemaRuleConfiguration();
+        Map<RuleConfiguration, SchemaRuleBuilder> actual = SchemaRuleBuilderFactory.getInstanceMap(Collections.singleton(configuration));
+        assertNotNull(actual);
+        assertFalse(actual.isEmpty());
+        assertTrue(actual.containsKey(configuration));
+        assertThat(actual.get(configuration), instanceOf(FixtureSchemaRuleBuilder.class));
+    }
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstanceMapWithComparator() {
+        Collection<RuleConfiguration> ruleConfigs = new ArrayList<>(2);
+        ruleConfigs.add(new FixtureSchemaRuleConfiguration());
+        ruleConfigs.add(new TestRuleConfiguration());
+        Map<RuleConfiguration, SchemaRuleBuilder> actual = SchemaRuleBuilderFactory.getInstanceMap(ruleConfigs, Comparator.naturalOrder());
+        assertNotNull(actual);

Review Comment:
   assertNotNull is unnecessary assertion in this case, it is better to remove it



##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/schema/SchemaRulesBuilderTest.java:
##########
@@ -38,7 +38,7 @@ public final class SchemaRulesBuilderTest {
     public void assertBuild() {
         Collection<ShardingSphereRule> actual = SchemaRulesBuilder.buildRules(
                 "schema_name", new DataSourceProvidedDatabaseConfiguration(Collections.emptyMap(), Collections.singleton(new TestRuleConfiguration())), new ConfigurationProperties(new Properties()));
-        assertThat(actual.size(), is(1));
+        assertThat(actual.size(), is(2));
         assertThat(actual.iterator().next(), instanceOf(TestShardingSphereRule.class));

Review Comment:
   Only assertion one item, but the actual size is 2, please add more assertion



##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/schema/DefaultSchemaRuleConfigurationBuilderFactoryTest.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.rule.builder.schema;
+
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureSchemaRuleBuilder;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureSchemaRuleConfigurationBuilder;
+import org.junit.Test;
+
+import java.util.Collections;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+public final class DefaultSchemaRuleConfigurationBuilderFactoryTest {
+    
+    @Test
+    @SuppressWarnings("rawtypes")
+    public void assertGetInstances() {
+        FixtureSchemaRuleBuilder builder = new FixtureSchemaRuleBuilder();
+        Map<SchemaRuleBuilder, DefaultSchemaRuleConfigurationBuilder> actual = DefaultSchemaRuleConfigurationBuilderFactory.getInstances(Collections.singleton(builder));
+        assertNotNull(actual);
+        assertFalse(actual.isEmpty());
+        assertTrue(actual.containsKey(builder));

Review Comment:
   assert contain key is unnecessary assertion in this case, it is better to remove it



##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/global/GlobalRuleBuilderFactoryTest.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.rule.builder.global;
+
+import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureGlobalRuleBuilder;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureGlobalRuleConfiguration;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+
+public final class GlobalRuleBuilderFactoryTest {
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstanceMap() {
+        FixtureGlobalRuleConfiguration configuration = new FixtureGlobalRuleConfiguration();
+        Map<RuleConfiguration, GlobalRuleBuilder> actual = GlobalRuleBuilderFactory.getInstanceMap(Collections.singletonList(configuration));
+        assertNotNull(actual);
+        assertFalse(actual.isEmpty());
+        assertTrue(actual.containsKey(configuration));

Review Comment:
   assert contain key is unnecessary assertion in this case, it is better to remove it



##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/schema/SchemaRuleBuilderFactoryTest.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.rule.builder.schema;
+
+import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.fixture.TestRuleConfiguration;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureSchemaRuleBuilder;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureSchemaRuleConfiguration;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+public final class SchemaRuleBuilderFactoryTest {
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstances() {
+        Collection<SchemaRuleBuilder> actual = SchemaRuleBuilderFactory.getInstances();
+        assertNotNull(actual);
+        assertFalse(actual.isEmpty());
+        assertThat(actual.size(), is(2));
+    }
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstanceMap() {
+        FixtureSchemaRuleConfiguration configuration = new FixtureSchemaRuleConfiguration();
+        Map<RuleConfiguration, SchemaRuleBuilder> actual = SchemaRuleBuilderFactory.getInstanceMap(Collections.singleton(configuration));
+        assertNotNull(actual);
+        assertFalse(actual.isEmpty());
+        assertTrue(actual.containsKey(configuration));

Review Comment:
   assert contain key is unnecessary assertion in this case, it is better to remove it



##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/schema/SchemaRuleBuilderFactoryTest.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.rule.builder.schema;
+
+import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.fixture.TestRuleConfiguration;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureSchemaRuleBuilder;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureSchemaRuleConfiguration;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+public final class SchemaRuleBuilderFactoryTest {
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstances() {
+        Collection<SchemaRuleBuilder> actual = SchemaRuleBuilderFactory.getInstances();
+        assertNotNull(actual);
+        assertFalse(actual.isEmpty());
+        assertThat(actual.size(), is(2));
+    }
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstanceMap() {
+        FixtureSchemaRuleConfiguration configuration = new FixtureSchemaRuleConfiguration();
+        Map<RuleConfiguration, SchemaRuleBuilder> actual = SchemaRuleBuilderFactory.getInstanceMap(Collections.singleton(configuration));
+        assertNotNull(actual);
+        assertFalse(actual.isEmpty());

Review Comment:
   assert is empty is unnecessary assertion in this case, it is better to remove it



##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/schema/SchemaRuleBuilderFactoryTest.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.rule.builder.schema;
+
+import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.fixture.TestRuleConfiguration;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureSchemaRuleBuilder;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureSchemaRuleConfiguration;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+public final class SchemaRuleBuilderFactoryTest {
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstances() {
+        Collection<SchemaRuleBuilder> actual = SchemaRuleBuilderFactory.getInstances();
+        assertNotNull(actual);
+        assertFalse(actual.isEmpty());

Review Comment:
   assert is empty is unnecessary assertion in this case, it is better to remove it



##########
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/builder/schema/SchemaRuleBuilderFactoryTest.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.infra.rule.builder.schema;
+
+import org.apache.shardingsphere.infra.config.RuleConfiguration;
+import org.apache.shardingsphere.infra.fixture.TestRuleConfiguration;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureSchemaRuleBuilder;
+import org.apache.shardingsphere.infra.rule.builder.fixture.FixtureSchemaRuleConfiguration;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+public final class SchemaRuleBuilderFactoryTest {
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstances() {
+        Collection<SchemaRuleBuilder> actual = SchemaRuleBuilderFactory.getInstances();
+        assertNotNull(actual);
+        assertFalse(actual.isEmpty());
+        assertThat(actual.size(), is(2));
+    }
+    
+    @SuppressWarnings("rawtypes")
+    @Test
+    public void assertGetInstanceMap() {
+        FixtureSchemaRuleConfiguration configuration = new FixtureSchemaRuleConfiguration();
+        Map<RuleConfiguration, SchemaRuleBuilder> actual = SchemaRuleBuilderFactory.getInstanceMap(Collections.singleton(configuration));
+        assertNotNull(actual);

Review Comment:
   assertNotNull is unnecessary assertion in this case, it is better to remove it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org