public static String getDynamicPropertiesAsString(
            Configuration baseConfig, Configuration targetConfig) {

        String[] newAddedConfigs =
                targetConfig.keySet().stream()
                        .flatMap(
                                (String key) -> {
                                    final String baseValue =
                                            baseConfig.get(
                                                    ConfigOptions.key(key)
                                                            .stringType()
                                                            .noDefaultValue());
                                    final String targetValue =
                                            targetConfig.get(
                                                    ConfigOptions.key(key)
                                                            .stringType()
                                                            .noDefaultValue());

                                    if (!baseConfig.keySet().contains(key)
                                            || !baseValue.equals(targetValue)) {
                                        return Stream.of(
                                                "-"
                                                        + CommandLineOptions.DYNAMIC_PROPERTY_OPTION
                                                                .getOpt()
                                                        + key
                                                        + CommandLineOptions.DYNAMIC_PROPERTY_OPTION
                                                                .getValueSeparator()
                                                        + escapeForDifferentOS(targetValue));
                                    } else {
                                        return Stream.empty();
                                    }
                                })
                        .toArray(String[]::new);
        return String.join(" ", newAddedConfigs);
    }
@Test
    void testGetDynamicPropertiesAsString() {
        final Configuration baseConfig = new Configuration();
        baseConfig.setString("key.a", "a");
        baseConfig.setString("key.b", "b1");

        final Configuration targetConfig = new Configuration();
        targetConfig.setString("key.b", "b2");
        targetConfig.setString("key.c", "c");

        final String dynamicProperties =
                BootstrapTools.getDynamicPropertiesAsString(baseConfig, targetConfig);
        if (OperatingSystem.isWindows()) {
            assertThat(dynamicProperties).isEqualTo("-Dkey.b=\"b2\" -Dkey.c=\"c\"");
        } else {
            assertThat(dynamicProperties).isEqualTo("-Dkey.b='b2' -Dkey.c='c'");
        }
    }