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 2026/03/14 05:31:05 UTC

(shardingsphere) branch master updated: Add more test cases on AlgorithmConfigurationTest (#38425)

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 51f387a1a48 Add more test cases on AlgorithmConfigurationTest (#38425)
51f387a1a48 is described below

commit 51f387a1a4864fb7bd11f771cc1a3695851f26f3
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Mar 14 13:30:59 2026 +0800

    Add more test cases on AlgorithmConfigurationTest (#38425)
---
 .../core/config/AlgorithmConfigurationTest.java    | 50 ++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/infra/algorithm/core/src/test/java/org/apache/shardingsphere/infra/algorithm/core/config/AlgorithmConfigurationTest.java b/infra/algorithm/core/src/test/java/org/apache/shardingsphere/infra/algorithm/core/config/AlgorithmConfigurationTest.java
new file mode 100644
index 00000000000..9ab17192f4a
--- /dev/null
+++ b/infra/algorithm/core/src/test/java/org/apache/shardingsphere/infra/algorithm/core/config/AlgorithmConfigurationTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.algorithm.core.config;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Properties;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class AlgorithmConfigurationTest {
+    
+    @Test
+    void assertConstruct() {
+        Properties props = new Properties();
+        AlgorithmConfiguration actual = new AlgorithmConfiguration("INLINE", props);
+        assertThat(actual.getType(), is("INLINE"));
+        assertThat(actual.getProps(), is(props));
+    }
+    
+    @Test
+    void assertConstructWithNullProps() {
+        AlgorithmConfiguration actual = new AlgorithmConfiguration("INLINE", null);
+        assertThat(actual.getType(), is("INLINE"));
+        assertTrue(actual.getProps().isEmpty());
+    }
+    
+    @Test
+    void assertConstructWithEmptyType() {
+        assertThat(assertThrows(IllegalArgumentException.class, () -> new AlgorithmConfiguration("", new Properties())).getMessage(), is("Type is required."));
+    }
+}