private void checkNotThrow(List<String> args) {
        AtomicReference<Integer> exitStatus = new AtomicReference<>();
        org.apache.kafka.common.utils.Exit.setExitProcedure((status, __) -> {
            exitStatus.set(status);
            throw new RuntimeException();
        });
        try {
            assertDoesNotThrow(() -> new AclCommandOptions(args.toArray(new String[0])).checkArgs());
            assertNull(exitStatus.get());
        } finally {
            org.apache.kafka.common.utils.Exit.resetExitProcedure();
        }
    }
Capture both the console output and console error during the execution of the provided function.
core/src/test/java/kafka/admin/AclCommandTest.java