Changeset 6568 in josm for trunk/test/unit/org/openstreetmap
- Timestamp:
- 2013-12-30T23:57:06+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/OpeningHourTestTest.java
r6533 r6568 5 5 import org.junit.Test; 6 6 import org.openstreetmap.josm.Main; 7 import org.openstreetmap.josm.data.osm.Tag; 7 8 import org.openstreetmap.josm.data.validation.Severity; 9 import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference; 10 import org.openstreetmap.josm.gui.tagging.TaggingPreset; 11 import org.openstreetmap.josm.gui.tagging.TaggingPresetItem; 12 import org.openstreetmap.josm.gui.tagging.TaggingPresetItems; 13 import org.openstreetmap.josm.gui.tagging.TaggingPresetReader; 14 import org.openstreetmap.josm.gui.tagging.TaggingPresetSearchAction; 8 15 16 import java.util.Arrays; 17 import java.util.Collection; 18 import java.util.LinkedHashSet; 9 19 import java.util.List; 20 import java.util.Set; 10 21 11 22 import static org.CustomMatchers.hasSize; … … 128 139 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Mo-Fr 13:30, 17:45, 19:00; Sa 15:00; Su 11:00", OpeningHourTest.CheckMode.BOTH).get(0).getPrettifiedValue(), is("Mo-Fr 13:30,17:45,19:00; Sa 15:00; Su 11:00")); 129 140 } 141 142 @Test 143 public void testPresetValues() throws Exception { 144 final Collection<TaggingPreset> presets = TaggingPresetReader.readFromPreferences(false); 145 final Set<Tag> values = new LinkedHashSet<Tag>(); 146 for (final TaggingPreset p : presets) { 147 for (final TaggingPresetItem i : p.data) { 148 if (i instanceof TaggingPresetItems.KeyedItem && 149 Arrays.asList("opening_hours", "service_times", "collection_times").contains(((TaggingPresetItems.KeyedItem) i).key)) { 150 for (final String v : ((TaggingPresetItems.KeyedItem) i).getValues()) { 151 values.add(new Tag(((TaggingPresetItems.KeyedItem) i).key, v)); 152 } 153 } 154 } 155 } 156 for (final Tag t : values) { 157 final List<OpeningHourTest.OpeningHoursTestError> errors = OPENING_HOUR_TEST.checkOpeningHourSyntax(t.getKey(), t.getValue()); 158 assertThat(t + " is valid", errors, isEmpty()); 159 } 160 } 130 161 }
Note:
See TracChangeset
for help on using the changeset viewer.