Changeset 15982 in josm for trunk/test/unit
- Timestamp:
- 2020-03-01T23:35:53+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/tools/UtilsTest.java
r15909 r15982 14 14 import java.util.Arrays; 15 15 import java.util.Collections; 16 import java.util.HashMap; 16 17 import java.util.LinkedList; 17 18 import java.util.List; 18 19 import java.util.Locale; 20 import java.util.Map; 21 import java.util.TreeMap; 19 22 import java.util.regex.Pattern; 20 23 … … 574 577 assertEquals(Arrays.asList("foo", "bar", "baz"), Utils.toUnmodifiableList(new LinkedList<>(Arrays.asList("foo", "bar", "baz")))); 575 578 } 579 580 /** 581 * Test of {@link Utils#toUnmodifiableMap} 582 */ 583 @Test 584 public void testToUnmodifiableMap() { 585 assertSame(Collections.emptyMap(), Utils.toUnmodifiableMap(null)); 586 assertSame(Collections.emptyMap(), Utils.toUnmodifiableMap(Collections.emptyMap())); 587 assertSame(Collections.emptyMap(), Utils.toUnmodifiableMap(new HashMap<>())); 588 assertSame(Collections.emptyMap(), Utils.toUnmodifiableMap(new TreeMap<>())); 589 assertEquals(Collections.singletonMap("foo", "bar"), Utils.toUnmodifiableMap(new HashMap<>(Collections.singletonMap("foo", "bar")))); 590 assertEquals(Collections.singletonMap("foo", "bar"), Utils.toUnmodifiableMap(new TreeMap<>(Collections.singletonMap("foo", "bar")))); 591 final Map<String, String> map4 = new HashMap<>(); 592 map4.put("jjj", "foo"); 593 map4.put("ooo", "bar"); 594 map4.put("sss", "baz"); 595 map4.put("mmm", ":-)"); 596 assertEquals(map4, Utils.toUnmodifiableMap(map4)); 597 } 576 598 }
Note:
See TracChangeset
for help on using the changeset viewer.