CheneyYin commented on code in PR #5928:
URL: https://github.com/apache/seatunnel/pull/5928#discussion_r1433985065


##########
seatunnel-core/seatunnel-core-starter/src/test/java/org/apache/seatunnel/core/starter/utils/FileUtilsTest.java:
##########
@@ -50,6 +53,18 @@ public void getConfigPath() throws URISyntaxException {
                 "flink.batch.conf", 
FileUtils.getConfigPath(sparkCommandArgs).toString());
     }
 
+    @Test
+    @DisabledOnOs(OS.WINDOWS)
+    void testExpectedError() {
+        SeaTunnelRuntimeException exception =
+                Assertions.assertThrows(
+                        SeaTunnelRuntimeException.class,
+                        () -> 
FileUtils.checkConfigExist(Paths.get("/tmp/not/existed")));
+        Assertions.assertEquals(
+                "ErrorCode:[COMMON-22], ErrorDescription:[SeaTunnel read file 
'/tmp/not/existed' failed, because it not existed.]",
+                exception.getMessage());
+    }
+

Review Comment:
   ```suggestion
       @Test
       void testExpectedError() {
           String root = File.listRoots()[0].getPath();
           // Unix Path: /tmp/not/existed
           // Windows Path: C:\tmp\not\existed
           Path path = Paths.get(root, "tmp", "not", "existed");
           SeaTunnelRuntimeException exception =
               Assertions.assertThrows(
                   SeaTunnelRuntimeException.class,
                   () -> 
FileUtils.checkConfigExist(Paths.get("/tmp/not/existed")));
           Assertions.assertEquals(
               "ErrorCode:[COMMON-22], ErrorDescription:[SeaTunnel read file '" 
+ path.toString() + "' failed, because it not existed.]",
               exception.getMessage());
       }
   
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to