public static String generateJvmOptsString(
            org.apache.flink.configuration.Configuration conf,
            List<ConfigOption<String>> jvmOptions,
            boolean hasKrb5) {
        StringBuilder javaOptsSb = new StringBuilder();
        for (ConfigOption<String> option : jvmOptions) {
            concatWithSpace(javaOptsSb, conf.get(option));
        }
        concatWithSpace(javaOptsSb, IGNORE_UNRECOGNIZED_VM_OPTIONS);

        // krb5.conf file will be available as local resource in JM/TM container
        if (hasKrb5) {
            concatWithSpace(javaOptsSb, "-Djava.security.krb5.conf=krb5.conf");
        }
        return javaOptsSb.toString().trim();
    }
@Test
    void testGenerateJvmOptsString() {
        final String defaultJvmOpts = "-DdefaultJvm";
        final String jvmOpts = "-Djvm";
        final String krb5 = "-Djava.security.krb5.conf=krb5.conf";
        final Configuration conf = new Configuration();
        conf.set(CoreOptions.FLINK_DEFAULT_JVM_OPTIONS, defaultJvmOpts);
        conf.set(CoreOptions.FLINK_JVM_OPTIONS, jvmOpts);
        final List<ConfigOption<String>> jvmOptions =
                Arrays.asList(CoreOptions.FLINK_DEFAULT_JVM_OPTIONS, CoreOptions.FLINK_JVM_OPTIONS);
        // With Krb5
        assertThat(Utils.generateJvmOptsString(conf, jvmOptions, true))
                .isEqualTo(
                        String.join(
                                " ",
                                defaultJvmOpts,
                                jvmOpts,
                                Utils.IGNORE_UNRECOGNIZED_VM_OPTIONS,
                                krb5));
        // Without Krb5
        assertThat(Utils.generateJvmOptsString(conf, jvmOptions, false))
                .isEqualTo(
                        String.join(
                                " ",
                                defaultJvmOpts,
                                jvmOpts,
                                Utils.IGNORE_UNRECOGNIZED_VM_OPTIONS));
    }