Changeset 9756 in josm
- Timestamp:
- 2016-02-08T00:25:12+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/imagery/ImageryInfoTest.java
r9713 r9756 6 6 import java.util.Arrays; 7 7 import java.util.Collections; 8 import java.util. List;8 import java.util.HashSet; 9 9 import java.util.Map; 10 import java.util.Set; 10 11 11 12 import org.junit.BeforeClass; … … 13 14 import org.openstreetmap.josm.JOSMFixture; 14 15 import org.openstreetmap.josm.data.Preferences; 16 import org.openstreetmap.josm.tools.MultiMap; 15 17 16 18 /** … … 46 48 public void testSerializeStruct() { 47 49 final ImageryInfo.ImageryPreferenceEntry info = new ImageryInfo.ImageryPreferenceEntry(); 48 info.noTileHeaders = Collections.singletonMap("ETag", Arrays.asList("foo", "bar")); 50 info.noTileHeaders = new MultiMap<>(); 51 info.noTileHeaders.put("ETag", "foo"); 52 info.noTileHeaders.put("ETag", "bar"); 49 53 final Map<String, String> map = Preferences.serializeStruct(info, ImageryInfo.ImageryPreferenceEntry.class); 50 54 assertEquals("{noTileHeaders={\"ETag\":[\"foo\",\"bar\"]}}", map.toString()); … … 58 62 final ImageryInfo.ImageryPreferenceEntry info = Preferences.deserializeStruct( 59 63 Collections.singletonMap("noTileHeaders", "{\"ETag\":[\"foo\",\"bar\"]}"), ImageryInfo.ImageryPreferenceEntry.class); 60 assertEquals(info.noTileHeaders, Collections.singletonMap("ETag", Arrays.asList("foo", "bar"))); 61 final List<String> eTag = info.noTileHeaders.get("ETag"); 62 assertEquals(eTag, Arrays.asList("foo", "bar")); 64 MultiMap<String, String> expect = new MultiMap<>(); 65 expect.put("ETag", "foo"); 66 expect.put("ETag", "bar"); 67 assertEquals(info.noTileHeaders, expect); 68 final Set<String> eTag = info.noTileHeaders.get("ETag"); 69 assertEquals(eTag, new HashSet<String>(Arrays.asList("foo", "bar"))); 63 70 } 64 71 … … 70 77 final ImageryInfo.ImageryPreferenceEntry info = Preferences.deserializeStruct( 71 78 Collections.singletonMap("noTileHeaders", "{\"ETag\":\"foo-and-bar\"}"), ImageryInfo.ImageryPreferenceEntry.class); 72 final List<String> eTag = info.noTileHeaders.get("ETag");73 assertEquals(eTag, Arrays.asList("foo", "bar"));79 final Set<String> eTag = info.noTileHeaders.get("ETag"); 80 assertEquals(eTag, Collections.singleton("foo-and-bar")); 74 81 } 75 82 }
Note:
See TracChangeset
for help on using the changeset viewer.