This is an automated email from the ASF dual-hosted git repository.

jinsongzhou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/amoro.git


The following commit(s) were added to refs/heads/master by this push:
     new c78036e12 [Improvement]: Improved test testGetUriPath in TestFileUtil 
by retrofitting to parameterized test (#3456)
c78036e12 is described below

commit c78036e128c1c231ec49f00df1013d72014a5461
Author: Monil <[email protected]>
AuthorDate: Wed Mar 5 04:14:51 2025 -0800

    [Improvement]: Improved test testGetUriPath in TestFileUtil by retrofitting 
to parameterized test (#3456)
    
    * Improved test in TestFileUtil by parameterizing
    
    * name fix
    
    * improved variable names
---
 .../java/org/apache/amoro/utils/TestFileUtil.java  | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git 
a/amoro-format-iceberg/src/test/java/org/apache/amoro/utils/TestFileUtil.java 
b/amoro-format-iceberg/src/test/java/org/apache/amoro/utils/TestFileUtil.java
index 6a2624d2e..e4bd2c0e7 100644
--- 
a/amoro-format-iceberg/src/test/java/org/apache/amoro/utils/TestFileUtil.java
+++ 
b/amoro-format-iceberg/src/test/java/org/apache/amoro/utils/TestFileUtil.java
@@ -29,6 +29,8 @@ import org.apache.iceberg.io.InputFile;
 import org.apache.iceberg.io.OutputFile;
 import org.junit.Assert;
 import org.junit.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
 import org.junit.rules.TemporaryFolder;
 
 import java.io.File;
@@ -63,14 +65,18 @@ public class TestFileUtil {
         fileDir);
   }
 
-  @Test
-  public void testGetUriPath() {
-    Assert.assertEquals("/a/b/c", 
TableFileUtil.getUriPath("hdfs://xxxxx/a/b/c"));
-    Assert.assertEquals("/a/b/c", 
TableFileUtil.getUriPath("hdfs://localhost:8888/a/b/c"));
-    Assert.assertEquals("/a/b/c", 
TableFileUtil.getUriPath("file://xxxxx/a/b/c"));
-    Assert.assertEquals("/a/b/c", TableFileUtil.getUriPath("/a/b/c"));
-    Assert.assertEquals("/a/b/c", TableFileUtil.getUriPath("hdfs:/a/b/c"));
-    Assert.assertEquals("a/b/c", TableFileUtil.getUriPath("a/b/c"));
+  @ParameterizedTest
+  @CsvSource(
+      value = {
+        "/a/b/c, hdfs://xxxxx/a/b/c",
+        "/a/b/c, hdfs://localhost:8888/a/b/c",
+        "/a/b/c, file://xxxxx/a/b/c",
+        "/a/b/c, /a/b/c",
+        "/a/b/c, hdfs:/a/b/c",
+        "a/b/c, a/b/c"
+      })
+  public void testGetUriPath(String expected, String path) {
+    Assert.assertEquals(expected, TableFileUtil.getUriPath(path));
   }
 
   private static final TemporaryFolder temp = new TemporaryFolder();

Reply via email to