You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/05/16 07:32:25 UTC

[shardingsphere] branch master updated: add test for DataNodeBuilderFactory (#17695)

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 28c656518bb add test for DataNodeBuilderFactory (#17695)
28c656518bb is described below

commit 28c656518bb9346dc3ad5a5a8980a45c964bf923
Author: csonezp <cs...@gmail.com>
AuthorDate: Mon May 16 15:32:20 2022 +0800

    add test for DataNodeBuilderFactory (#17695)
---
 .../infra/datanode/DataNodeBuilderFactoryTest.java | 44 ++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodeBuilderFactoryTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodeBuilderFactoryTest.java
new file mode 100644
index 00000000000..21192270a84
--- /dev/null
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/datanode/DataNodeBuilderFactoryTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.datanode;
+
+import org.apache.shardingsphere.infra.fixture.TestShardingSphereRule;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
+import org.junit.Test;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.mock;
+
+public final class DataNodeBuilderFactoryTest {
+    
+    @Test
+    public void assertGetInstances() {
+        TestShardingSphereRule key = mock(TestShardingSphereRule.class);
+        Collection<ShardingSphereRule> rules = Collections.singletonList(key);
+        Map<ShardingSphereRule, DataNodeBuilder> actual = DataNodeBuilderFactory.getInstances(rules);
+        assertThat(actual.size(), is(1));
+        assertThat(actual.get(key), instanceOf(DataNodeBuilder.class));
+    }
+    
+}