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

ddanielr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new e498b624d5 Add missing fail() to TestHelp tests (#6630)
e498b624d5 is described below

commit e498b624d55415330426b26af234df560ba1308d
Author: Sharang Gupta <[email protected]>
AuthorDate: Sat Nov 7 01:08:40 2026 +0000

    Add missing fail() to TestHelp tests (#6630)
    
    * Add missing fail() to TestHelp tests
    
    testInvalidArgs and testHelpCommand checked the exit status only in the
    catch block, so they passed when parseArgs returned without exiting.
    
    * Name the args in TestHelp and drop dead assert
    
    As suggested in review: the assertTrue after parseArgs could never run,
    and the failure message now shows the arguments that did not exit.
---
 core/src/test/java/org/apache/accumulo/core/cli/TestHelp.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/core/src/test/java/org/apache/accumulo/core/cli/TestHelp.java 
b/core/src/test/java/org/apache/accumulo/core/cli/TestHelp.java
index 45c554e626..e3bff6e096 100644
--- a/core/src/test/java/org/apache/accumulo/core/cli/TestHelp.java
+++ b/core/src/test/java/org/apache/accumulo/core/cli/TestHelp.java
@@ -19,7 +19,9 @@
 package org.apache.accumulo.core.cli;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
+import java.util.Arrays;
 
 import org.junit.jupiter.api.Test;
 
@@ -44,6 +46,7 @@ public class TestHelp {
     HelpStub help = new HelpStub();
     try {
       help.parseArgs("program", args);
+      fail("Expected parseArgs to exit for an invalid argument " + 
Arrays.toString(args));
     } catch (RuntimeException e) {
       assertEquals("1", e.getMessage());
     }
@@ -60,7 +63,7 @@ public class TestHelp {
     TestHelpOpt opts = new TestHelpOpt();
     try {
       opts.parseArgs("program", args);
-      assertTrue(opts.test);
+      fail("Expected parseArgs to exit for --help");
     } catch (RuntimeException e) {
       assertEquals("0", e.getMessage());
     }

Reply via email to