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 920dc089761 Add more test cases on ConnectionPropertiesTest (#38102)
920dc089761 is described below

commit 920dc089761c4fa675ae9a567d2869a3c887cd99
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Feb 19 20:52:46 2026 +0800

    Add more test cases on ConnectionPropertiesTest (#38102)
---
 .../jdbcurl/parser/ConnectionPropertiesTest.java   | 50 ++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git 
a/database/connector/core/src/test/java/org/apache/shardingsphere/database/connector/core/jdbcurl/parser/ConnectionPropertiesTest.java
 
b/database/connector/core/src/test/java/org/apache/shardingsphere/database/connector/core/jdbcurl/parser/ConnectionPropertiesTest.java
new file mode 100644
index 00000000000..737e258831a
--- /dev/null
+++ 
b/database/connector/core/src/test/java/org/apache/shardingsphere/database/connector/core/jdbcurl/parser/ConnectionPropertiesTest.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.database.connector.core.jdbcurl.parser;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Properties;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+class ConnectionPropertiesTest {
+    
+    @Test
+    void assertChangeCatalog() {
+        Properties queryProperties = new Properties();
+        ConnectionProperties actual = new ConnectionProperties("127.0.0.1", 
3306, "foo_catalog", "foo_schema", 
queryProperties).changeCatalog("bar_catalog");
+        assertThat(actual.getHostname(), is("127.0.0.1"));
+        assertThat(actual.getPort(), is(3306));
+        assertThat(actual.getCatalog(), is("bar_catalog"));
+        assertThat(actual.getSchema(), is("foo_schema"));
+        assertThat(actual.getQueryProperties(), is(queryProperties));
+    }
+    
+    @Test
+    void assertChangeCatalogWithNullValue() {
+        Properties queryProperties = new Properties();
+        ConnectionProperties actual = new ConnectionProperties("127.0.0.1", 
3306, "foo_catalog", "foo_schema", queryProperties).changeCatalog(null);
+        assertThat(actual.getHostname(), is("127.0.0.1"));
+        assertThat(actual.getPort(), is(3306));
+        assertThat(actual.getCatalog(), is("foo_catalog"));
+        assertThat(actual.getSchema(), is("foo_schema"));
+        assertThat(actual.getQueryProperties(), is(queryProperties));
+    }
+}

Reply via email to