This is an automated email from the ASF dual-hosted git repository.
zrlw pushed a commit to branch 3.3
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.3 by this push:
new cae2fcfc0f Add unit test for PathUtils in dubbo-common (#16001)
cae2fcfc0f is described below
commit cae2fcfc0f719896e47ddbce237afcb89c75fe0b
Author: conellimo <[email protected]>
AuthorDate: Thu Jan 15 05:56:39 2026 +0300
Add unit test for PathUtils in dubbo-common (#16001)
* Add unit test for PathUtils in dubbo-common
* Add edge cases for PathUtilsTest
---
.../apache/dubbo/common/utils/PathUtilsTest.java | 39 ++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git
a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/PathUtilsTest.java
b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/PathUtilsTest.java
new file mode 100644
index 0000000000..1c325be3f3
--- /dev/null
+++
b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/PathUtilsTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.dubbo.common.utils;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+class PathUtilsTest {
+ @Test
+ void testBuildPath() {
+ Assertions.assertEquals("a/b/c", PathUtils.buildPath("a", "b", "c"));
+ Assertions.assertEquals("root/sub", PathUtils.buildPath("root",
"sub"));
+ }
+
+ @Test
+ void testNormalize() {
+ Assertions.assertEquals("/path", PathUtils.normalize("//path"));
+ Assertions.assertEquals("/api/v1",
PathUtils.normalize("/api/v1?name=dubbo"));
+ // Empty and Null handling (The "Edge Cases")
+ Assertions.assertEquals("/", PathUtils.normalize(""));
+ Assertions.assertEquals("/", PathUtils.normalize(null));
+ // Multiple slashes
+ Assertions.assertEquals("/a/b/c", PathUtils.normalize("/a//b///c"));
+ }
+}