@Test
    public void testSplitNormal() {
        List<Map<String, String>> list =
                splitKv("f1=a\nf1=b", '&', '=', '\\', '\"',
                        '\n', true);
        List<Map<String, String>> expectedList = new ArrayList<>();
        expectedList.add(new HashMap<String, String>() {

            {
                put("f1", "a");
            }
        });
        expectedList.add(new HashMap<String, String>() {

            {
                put("f1", "b");
            }
        });
        assertEquals(list, expectedList);

        assertEquals(
                new HashMap<String, String>() {

                    {
                        put("f1", "a");
                        put("f2", "b");
                        put("f3", "c");
                    }
                },
                splitKv("f1=a&f2=b&f3=c", '&', '=', null, null));

        assertEquals(
                new HashMap<String, String>() {

                    {
                        put("f1", "");
                        put("f2", "b");
                        put("f3", "c");
                    }
                },
                splitKv("f1=&f2=b&f3=c", '&', '=', null, null));

        assertEquals(
                new HashMap<String, String>() {

                    {
                        put("f1", "a");
                        put("f2", "b");
                        put("f3", "");
                    }
                },
                splitKv("f1=a&f2=b&f3=", '&', '=', null, null));

        assertEquals(
                new HashMap<String, String>() {

                    {
                        put("=f1", "a");
                        put("f2", "b");
                        put("f3", "c");
                    }
                },
                splitKv("\\=f1=a&f2=b&f3=c", '&', '=', '\\', null));

        assertEquals(
                new HashMap<String, String>() {

                    {
                        put("&f1", "a");
                        put("f2", "b");
                        put("f3", "c");
                    }
                },
                splitKv("\\&f1=a&f2=b&f3=c", '&', '=', '\\', null));

        assertEquals(
                new HashMap<String, String>() {

                    {
                        put("&f1", "a");
                        put("f2", "b");
                        put("f3", "c");
                    }
                },
                splitKv("\"&f1\"=a&f2=b&f3=c", '&', '=', '\\', '\"'));

        assertEquals(
                new HashMap<String, String>() {

                    {
                        put("f1", "a&");
                        put("f2", "b");
                        put("f3", "c");
                    }
                },
                splitKv("f1=a\\&&f2=b&f3=c", '&', '=', '\\', null));

        assertEquals(
                new HashMap<String, String>() {

                    {
                        put("f1", "a\\");
                        put("f2", "b");
                        put("f3", "c");
                    }
                },
                splitKv("f1=a\\\\&f2=b&f3=c", '&', '=', '\\', null));

        assertEquals(
                new HashMap<String, String>() {

                    {
                        put("f1", "a&f2=b");
                        put("f3", "c");
                        put("f4", "d");
                    }
                },
                splitKv("f1=a\"&f2=\"b&f3=c&f4=d", '&', '=', '\\', '\"'));

        assertEquals(
                new HashMap<String, String>() {

                    {
                        put("f1", "atest\\test");
                        put("f2", "b");
                        put("f3", "c");
                    }
                },
                splitKv("f1=a\"test\\test\"&f2=b&f3=c", '&', '=', '\\', '\"'));

        assertEquals(
                new HashMap<String, String>() {

                    {
                        put("f1", "a");
                        put("f2", "\"b");
                        put("f3", "c\"");
                        put("f4", "d");
                    }
                },
                splitKv("f1=a&f2=\\\"b&f3=c\\\"&f4=d", '&', '=', '\\', '\"'));

        assertEquals(
                new HashMap<String, String>() {

                    {
                        put("f1", "b");
                    }
                },
                splitKv("f1=a&f1=b", '&', '=', '\\', '\"'));

        assertEquals(
                new HashMap<String, String>() {

                    {
                        put("", "a");
                        put("f", "");
                    }
                },
                splitKv("=a&f=", '&', '=', '\\', '\"'));
    }
Unit tests for kv splitting and concating.
inlong-sort/sort-formats/format-rowdata/format-rowdata-kv/src/test/java/org/apache/inlong/sort/formats/kv/KvUtilsTest.java