joshua2519 commented on code in PR #20293:
URL: https://github.com/apache/kafka/pull/20293#discussion_r2309566185


##########
tools/src/main/java/org/apache/kafka/tools/streams/StreamsGroupCommand.java:
##########
@@ -98,12 +99,19 @@ public static void main(String[] args) {
                 CommandLineUtils.printUsageAndExit(opts.parser, "Command must 
include exactly one action: --list, --describe, --delete, --reset-offsets, or 
--delete-offsets.");
 
             run(opts);
-        } catch (OptionException e) {

Review Comment:
   Thanks for pointing that out. I've updated the code to catch it. 



##########
tools/src/test/java/org/apache/kafka/tools/streams/DeleteStreamsGroupOffsetTest.java:
##########
@@ -436,4 +440,26 @@ private StreamsGroupCommand.StreamsGroupService 
getStreamsGroupService(String[]
             opts, cluster.createAdminClient());
 
     }
+
+    /**
+     * Executes the StreamsGroupCommand with the given arguments and validates 
the exit code.
+     * <p>
+     * This helper method is used to test scenarios where the command is 
expected to exit
+     * with a specific status code (e.g., 0 for success, 1 for an error). It 
captures the
+     * exit code by using a mock {@link Exit.Procedure} and asserts that it 
matches the
+     * expected value.
+     *
+     * @param args             The command-line arguments to pass to the 
StreamsGroupCommand.
+     * @param expectedExitCode The expected exit code from the command 
execution.
+     */
+    private static void validateDeleteOffsetsExitCode(String[] args, int 
expectedExitCode) {

Review Comment:
   Thanks for the suggestion! 
   I've refactored main() based on your idea.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to