public static Map<String, String> parseParameters(String rawParameters) {
        if (StringUtils.isBlank(rawParameters)) {
            return Collections.emptyMap();
        }
        Matcher matcher = PARAMETERS_PATTERN.matcher(rawParameters);
        if (!matcher.matches()) {
            return Collections.emptyMap();
        }

        String pairs = matcher.group(1);
        String[] pairArr = pairs.split("\\s*,\\s*");

        Map<String, String> parameters = new HashMap<>();
        for (String pair : pairArr) {
            Matcher pairMatcher = PAIR_PARAMETERS_PATTERN.matcher(pair);
            if (pairMatcher.matches()) {
                parameters.put(pairMatcher.group(1), pairMatcher.group(2));
            }
        }
        return parameters;
    }
@Test
    void testParseParameters() {
        String legalStr = "[{key1:value1},{key2:value2}]";
        Map<String, String> legalMap = StringUtils.parseParameters(legalStr);
        assertEquals(2, legalMap.size());
        assertEquals("value2", legalMap.get("key2"));

        String str = StringUtils.encodeParameters(legalMap);
        assertEqualsWithoutSpaces(legalStr, str);

        String legalSpaceStr = "[{key1: value1}, {key2 :value2}]";
        Map<String, String> legalSpaceMap = StringUtils.parseParameters(legalSpaceStr);
        assertEquals(2, legalSpaceMap.size());
        assertEquals("value2", legalSpaceMap.get("key2"));

        str = StringUtils.encodeParameters(legalSpaceMap);
        assertEqualsWithoutSpaces(legalSpaceStr, str);

        String legalSpecialStr = "[{key-1: value*.1}, {key.2 :value*.-_2}]";
        Map<String, String> legalSpecialMap = StringUtils.parseParameters(legalSpecialStr);
        assertEquals(2, legalSpecialMap.size());
        assertEquals("value*.1", legalSpecialMap.get("key-1"));
        assertEquals("value*.-_2", legalSpecialMap.get("key.2"));

        str = StringUtils.encodeParameters(legalSpecialMap);
        assertEqualsWithoutSpaces(legalSpecialStr, str);

        String illegalStr = "[{key=value},{aa:bb}]";
        Map<String, String> illegalMap = StringUtils.parseParameters(illegalStr);
        assertEquals(0, illegalMap.size());

        str = StringUtils.encodeParameters(illegalMap);
        assertEquals(null, str);

        String emptyMapStr = "[]";
        Map<String, String> emptyMap = StringUtils.parseParameters(emptyMapStr);
        assertEquals(0, emptyMap.size());
    }