@@ -2365,6 +2365,66 @@ void parseAttributes() {
23652365 Xml .parseAttributes (" version = 1.0\" encoding= \" UTF-8\" " ).toString ());
23662366 }
23672367
2368+ @ Test
2369+ void testSingleAttribute () {
2370+ Map <String , String > result = Xml .parseAttributes ("key1=\" value1\" " );
2371+ assertEquals (Map .of ("key1" , "value1" ), result );
2372+ }
2373+
2374+ @ Test
2375+ void testMultipleAttributes () {
2376+ Map <String , String > result = Xml .parseAttributes ("key1=\" value1\" key2=\" value2\" " );
2377+ assertEquals (Map .of ("key1" , "value1" , "key2" , "value2" ), result );
2378+ }
2379+
2380+ @ Test
2381+ void testAttributeWithSpaces () {
2382+ Map <String , String > result = Xml .parseAttributes ("key1=\" value with spaces\" key2=\" another value\" " );
2383+ assertEquals (Map .of ("key1" , "value with spaces" , "key2" , "another value" ), result );
2384+ }
2385+
2386+ @ Test
2387+ void testEmptyValue () {
2388+ Map <String , String > result = Xml .parseAttributes ("key1=\" value1\" key2=\" \" " );
2389+ assertEquals (Map .of ("key1" , "value1" , "key2" , "" ), result );
2390+ }
2391+
2392+ @ Test
2393+ void testAttributesWithoutSpaceSeparation () {
2394+ Map <String , String > result = Xml .parseAttributes ("key1=\" value1\" key2=\" value2\" " );
2395+ assertEquals (Map .of ("key1" , "value1" , "key2" , "value2" ), result );
2396+ }
2397+
2398+ @ Test
2399+ void testUnclosedQuotes () {
2400+ Map <String , String > result = Xml .parseAttributes ("key1=\" value1 key2=\" value2\" " );
2401+ assertEquals (Map .of ("key1" , "value1 key2=" ), result );
2402+ }
2403+
2404+ @ Test
2405+ void testEqualsSignInValue () {
2406+ Map <String , String > result = Xml .parseAttributes ("key1=\" value=1\" key2=\" value=2\" " );
2407+ assertEquals (Map .of ("key1" , "value=1" , "key2" , "value=2" ), result );
2408+ }
2409+
2410+ @ Test
2411+ void testTrailingWhitespace () {
2412+ Map <String , String > result = Xml .parseAttributes ("key1=\" value1\" key2=\" value2\" " );
2413+ assertEquals (Map .of ("key1" , "value1" , "key2" , "value2" ), result );
2414+ }
2415+
2416+ @ Test
2417+ void testLeadingWhitespace () {
2418+ Map <String , String > result = Xml .parseAttributes (" key1=\" value1\" key2=\" value2\" " );
2419+ assertEquals (Map .of ("key1" , "value1" , "key2" , "value2" ), result );
2420+ }
2421+
2422+ @ Test
2423+ void testNoEqualsSign () {
2424+ Map <String , String > result = Xml .parseAttributes ("key1\" value1\" key2=\" value2\" " );
2425+ assertEquals (Map .of ("key1key2" , "value1value2" ), result );
2426+ }
2427+
23682428 @ SuppressWarnings ("unchecked" )
23692429 @ Test
23702430 void toJsonFromXml23 () {
0 commit comments