Changeset 9832 in josm for trunk/test
- Timestamp:
- 2016-02-19T12:36:11+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/preferences/PreferencesWriterTest.java
r9828 r9832 10 10 import java.util.HashMap; 11 11 import java.util.Map; 12 import java.util.SortedMap; 13 import java.util.TreeMap; 12 14 13 15 import org.junit.Test; … … 105 107 } 106 108 } 109 110 /** 111 * Test null value in default preferences. 112 * @throws IOException 113 */ 114 @Test 115 public void testNullValue() throws IOException { 116 long time = System.currentTimeMillis() / 1000; 117 // CHECKSTYLE.OFF: LineLength 118 String expected = String.format("<?xml version=\"1.0\" encoding=\"UTF-8\"?>%n" + 119 "<preferences-defaults xmlns='http://josm.openstreetmap.de/preferences-1.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' version='%d'>%n" + 120 " <list key='foo_list' time='%2$d' xsi:nil='true'/>%n" + 121 " <lists key='foo_listlist' time='%2$d' xsi:nil='true'/>%n" + 122 " <maps key='foo_maplist' time='%2$d' xsi:nil='true'/>%n" + 123 " <tag key='foo_tag' time='%2$d' xsi:nil='true'/>%n" + 124 "</preferences-defaults>%n", 125 Version.getInstance().getVersion(), time); 126 // CHECKSTYLE.ON: LineLength 127 try (StringWriter out = new StringWriter(); PreferencesWriter w = new PreferencesWriter(new PrintWriter(out), true, true)) { 128 SortedMap<String, Setting<?>> map = new TreeMap<>(); 129 map.put("foo_tag", setting(new StringSetting(null), time)); 130 map.put("foo_list", setting(new ListSetting(null), time)); 131 map.put("foo_listlist", setting(new ListListSetting(null), time)); 132 map.put("foo_maplist", setting(new MapListSetting(null), time)); 133 w.write(map.entrySet()); 134 assertEquals(expected, out.toString()); 135 } 136 } 107 137 }
Note:
See TracChangeset
for help on using the changeset viewer.