Changeset 16472 in josm for trunk/test/unit/org


Ignore:
Timestamp:
2020-05-21T00:29:30+02:00 (5 years ago)
Author:
simon04
Message:

see #19269 - TextTagParser.readTagsByRegexp: retain order of tags when parsing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/tools/TextTagParserTest.java

    r15750 r16472  
    44import static org.junit.Assert.assertEquals;
    55
     6import java.util.ArrayList;
     7import java.util.Arrays;
    68import java.util.Collections;
    79import java.util.HashMap;
     10import java.util.List;
    811import java.util.Map;
    912
     
    173176        assertEquals(expected, TextTagParser.readTagsFromText("name=Main street\nurl=https://example.com/?id=1"));
    174177    }
     178
     179    /**
     180     * Tests that the tags ordering is stable.
     181     */
     182    @Test
     183    public void testStableOrder() {
     184        List<String> expected = Arrays.asList("foo4", "foo3", "foo2", "foo1");
     185        ArrayList<String> actual = new ArrayList<>(TextTagParser.readTagsByRegexp(
     186                "foo4=bar4 foo3=bar3 foo2=bar2 foo1=bar1", " ", "(.*?)=(.*?)", true).keySet());
     187        assertEquals(expected, actual);
     188    }
    175189}
Note: See TracChangeset for help on using the changeset viewer.