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

pdallig pushed a commit to branch branch-0.12
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/branch-0.12 by this push:
     new 00599c76a3 [ZEPPELIN-6254] Add test case in file interpreter
00599c76a3 is described below

commit 00599c76a39cb05d2280aa8d9d2a9401e922d0e7
Author: Juyeon <procea...@gmail.com>
AuthorDate: Mon Jul 21 16:59:53 2025 +0900

    [ZEPPELIN-6254] Add test case in file interpreter
    
    ### What is this PR for?
    Added test cases to the file interpreter to increase test coverage.
    
    ### What type of PR is it?
    Improvement
    
    ### Todos
    * command is null
    * use unknown command
    * no such directory/file
    
    ### What is the Jira issue?
    https://issues.apache.org/jira/browse/ZEPPELIN-6254
    
    ### How should this be tested?
    Run test in file interpreter
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Does the license files need to update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Closes #4994 from proceane/feature/ZEPPELIN-6254.
    
    Signed-off-by: Philipp Dallig <philipp.dal...@gmail.com>
    (cherry picked from commit 9cf41211dcc17a84dd483f2984a52c4be53aa08f)
    Signed-off-by: Philipp Dallig <philipp.dal...@gmail.com>
---
 .../zeppelin/file/HDFSFileInterpreterTest.java     | 50 ++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git 
a/file/src/test/java/org/apache/zeppelin/file/HDFSFileInterpreterTest.java 
b/file/src/test/java/org/apache/zeppelin/file/HDFSFileInterpreterTest.java
index 515babecd3..5c9e268e5d 100644
--- a/file/src/test/java/org/apache/zeppelin/file/HDFSFileInterpreterTest.java
+++ b/file/src/test/java/org/apache/zeppelin/file/HDFSFileInterpreterTest.java
@@ -133,6 +133,56 @@ class HDFSFileInterpreterTest {
 
     t.close();
   }
+
+  @Test
+  void testCommandIsNull() {
+    HDFSFileInterpreter t = new MockHDFSFileInterpreter(new Properties());
+    t.open();
+
+    InterpreterResult result = t.interpret(null, null);
+    assertEquals(InterpreterResult.Type.TEXT, 
result.message().get(0).getType());
+    assertEquals("No command", result.message().get(0).getData());
+
+    t.close();
+  }
+
+  @Test
+  void testUnknownCommand() {
+    HDFSFileInterpreter t = new MockHDFSFileInterpreter(new Properties());
+    t.open();
+
+    InterpreterResult result = t.interpret("unknown", null);
+    assertEquals(InterpreterResult.Type.TEXT, 
result.message().get(0).getType());
+    assertEquals("Unknown command", result.message().get(0).getData());
+
+    t.close();
+  }
+
+  @Test
+  void testNoSuchDirectory() {
+    HDFSFileInterpreter t = new MockHDFSFileInterpreter(new Properties());
+    t.open();
+
+    InterpreterResult result = t.interpret("cd /tmp/ida8c06540_date040315", 
null);
+    assertEquals(InterpreterResult.Type.TEXT, 
result.message().get(0).getType());
+    assertEquals("/tmp/ida8c06540_date040315: No such directory",
+            result.message().get(0).getData());
+
+    t.close();
+  }
+
+  @Test
+  void testNoSuchFile() {
+    HDFSFileInterpreter t = new MockHDFSFileInterpreter(new Properties());
+    t.open();
+
+    InterpreterResult result = t.interpret("ls -l /does/not/exist", null);
+    assertEquals(InterpreterResult.Type.TEXT, 
result.message().get(0).getType());
+    assertEquals("No such File or directory", 
result.message().get(0).getData());
+
+    t.close();
+  }
+
 }
 
 /**

Reply via email to