static String convertToString(Object o, boolean standardYaml) {
        if (standardYaml) {
            if (o.getClass() == String.class) {
                return (String) o;
            } else {
                return YamlParserUtils.toYAMLString(o);
            }
        }

        if (o.getClass() == String.class) {
            return (String) o;
        } else if (o.getClass() == Duration.class) {
            Duration duration = (Duration) o;
            return TimeUtils.formatWithHighestUnit(duration);
        } else if (o instanceof List) {
            return ((List<?>) o)
                    .stream()
                            .map(e -> escapeWithSingleQuote(convertToString(e, false), ";"))
                            .collect(Collectors.joining(";"));
        } else if (o instanceof Map) {
            return ((Map<?, ?>) o)
                    .entrySet().stream()
                            .map(
                                    e -> {
                                        String escapedKey =
                                                escapeWithSingleQuote(e.getKey().toString(), ":");
                                        String escapedValue =
                                                escapeWithSingleQuote(e.getValue().toString(), ":");

                                        return escapeWithSingleQuote(
                                                escapedKey + ":" + escapedValue, ",");
                                    })
                            .collect(Collectors.joining(","));
        }

        return o.toString();
    }
@TestTemplate
    void testConvertToString() {
        // String
        assertThat(ConfigurationUtils.convertToString("Simple String", standardYaml))
                .isEqualTo("Simple String");

        // Duration
        assertThat(ConfigurationUtils.convertToString(Duration.ZERO, standardYaml))
                .isEqualTo("0 ms");
        assertThat(ConfigurationUtils.convertToString(Duration.ofMillis(123L), standardYaml))
                .isEqualTo("123 ms");
        assertThat(ConfigurationUtils.convertToString(Duration.ofMillis(1_234_000L), standardYaml))
                .isEqualTo("1234 s");
        assertThat(ConfigurationUtils.convertToString(Duration.ofHours(25L), standardYaml))
                .isEqualTo("25 h");

        // List
        List<Object> listElements = new ArrayList<>();
        listElements.add("Test;String");
        listElements.add(Duration.ZERO);
        listElements.add(42);
        if (standardYaml) {
            assertThat("[Test;String, 0 ms, 42]")
                    .isEqualTo(ConfigurationUtils.convertToString(listElements, true));
        } else {
            assertThat("'Test;String';0 ms;42")
                    .isEqualTo(ConfigurationUtils.convertToString(listElements, false));
        }
        // Map
        Map<Object, Object> mapElements = new HashMap<>();
        mapElements.put("A:,B", "C:,D");
        mapElements.put(10, 20);
        if (standardYaml) {
            assertThat("{'A:,B': 'C:,D', 10: 20}")
                    .isEqualTo(ConfigurationUtils.convertToString(mapElements, true));
        } else {
            assertThat("'''A:,B'':''C:,D''',10:20")
                    .isEqualTo(ConfigurationUtils.convertToString(mapElements, false));
        }
    }