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

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


The following commit(s) were added to refs/heads/master by this push:
     new cc18e3e4a Call getLogHandler in ShellUtilsTest failure tests (#9251)
cc18e3e4a is described below

commit cc18e3e4ad045a8da35975f7cdc8dd8803e1b52d
Author: Sharang Gupta <[email protected]>
AuthorDate: Wed Nov 4 07:14:06 2026 +0000

    Call getLogHandler in ShellUtilsTest failure tests (#9251)
    
    getLogHandler_notFound and getLogHandler_notAShellLogHandler only built
    the config map and never called getLogHandler, so they passed without
    checking anything.
---
 .../test/jvm/org/apache/storm/utils/ShellUtilsTest.java  | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/storm-client/test/jvm/org/apache/storm/utils/ShellUtilsTest.java 
b/storm-client/test/jvm/org/apache/storm/utils/ShellUtilsTest.java
index 80e853f5c..064bf466d 100644
--- a/storm-client/test/jvm/org/apache/storm/utils/ShellUtilsTest.java
+++ b/storm-client/test/jvm/org/apache/storm/utils/ShellUtilsTest.java
@@ -54,11 +54,9 @@ public class ShellUtilsTest {
      */
     @Test
     public void getLogHandler_notFound() {
-        try {
-            configureLogHandler("class.not.Found");
-        } catch (RuntimeException e) {
-            assert (e.getCause().getClass() == ClassNotFoundException.class);
-        }
+        Map<String, Object> conf = configureLogHandler("class.not.Found");
+        RuntimeException e = assertThrows(RuntimeException.class, () -> 
ShellUtils.getLogHandler(conf));
+        assertSame(ClassNotFoundException.class, e.getCause().getClass());
     }
 
     /**
@@ -68,11 +66,9 @@ public class ShellUtilsTest {
      */
     @Test
     public void getLogHandler_notAShellLogHandler() {
-        try {
-            configureLogHandler("java.lang.String");
-        } catch (RuntimeException e) {
-            assert (e.getCause().getClass() == ClassCastException.class);
-        }
+        Map<String, Object> conf = configureLogHandler("java.lang.String");
+        RuntimeException e = assertThrows(RuntimeException.class, () -> 
ShellUtils.getLogHandler(conf));
+        assertSame(ClassCastException.class, e.getCause().getClass());
     }
 
     /**

Reply via email to