Changeset 8863 in josm for trunk/test/unit
- Timestamp:
- 2015-10-12T22:58:25+02:00 (9 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 1 added
- 5 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ConditionalKeysTest.groovy
r7938 r8863 3 3 4 4 import org.openstreetmap.josm.JOSMFixture 5 import org.openstreetmap.josm.gui.tagging. TaggingPresets5 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; 6 6 7 7 class ConditionalKeysTest extends GroovyTestCase { -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/OpeningHourTestTest.java
r8857 r8863 21 21 import org.openstreetmap.josm.data.osm.Tag; 22 22 import org.openstreetmap.josm.data.validation.Severity; 23 import org.openstreetmap.josm.gui.tagging. TaggingPreset;24 import org.openstreetmap.josm.gui.tagging. TaggingPresetItem;25 import org.openstreetmap.josm.gui.tagging. TaggingPresetItems;26 import org.openstreetmap.josm.gui.tagging. TaggingPresetReader;23 import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset; 24 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetItem; 25 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetReader; 26 import org.openstreetmap.josm.gui.tagging.presets.items.KeyedItem; 27 27 28 28 /** … … 213 213 for (final TaggingPreset p : presets) { 214 214 for (final TaggingPresetItem i : p.data) { 215 if (i instanceof TaggingPresetItems.KeyedItem &&216 Arrays.asList("opening_hours", "service_times", "collection_times").contains((( TaggingPresetItems.KeyedItem) i).key)) {217 for (final String v : (( TaggingPresetItems.KeyedItem) i).getValues()) {218 values.add(new Tag((( TaggingPresetItems.KeyedItem) i).key, v));215 if (i instanceof KeyedItem && 216 Arrays.asList("opening_hours", "service_times", "collection_times").contains(((KeyedItem) i).key)) { 217 for (final String v : ((KeyedItem) i).getValues()) { 218 values.add(new Tag(((KeyedItem) i).key, v)); 219 219 } 220 220 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/RelationCheckerTest.groovy
r7938 r8863 9 9 import org.openstreetmap.josm.data.osm.Way 10 10 import org.openstreetmap.josm.data.validation.TestError 11 import org.openstreetmap.josm.gui.tagging. TaggingPresets11 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; 12 12 13 13 class RelationCheckerTest extends GroovyTestCase { -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/TagCheckerTest.java
r8857 r8863 13 13 import org.openstreetmap.josm.data.osm.OsmUtils; 14 14 import org.openstreetmap.josm.data.validation.TestError; 15 import org.openstreetmap.josm.gui.tagging. TaggingPresets;15 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; 16 16 17 17 /** -
trunk/test/unit/org/openstreetmap/josm/gui/DefaultNameFormatterTest.java
r8857 r8863 20 20 import org.openstreetmap.josm.data.osm.Relation; 21 21 import org.openstreetmap.josm.data.osm.Way; 22 import org.openstreetmap.josm.gui.tagging. TaggingPresetReader;23 import org.openstreetmap.josm.gui.tagging. TaggingPresets;22 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetReader; 23 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; 24 24 import org.openstreetmap.josm.io.Compression; 25 25 import org.openstreetmap.josm.io.IllegalDataException; -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/PresetClassificationsTest.java
r8862 r8863 1 1 // License: GPL. For details, see LICENSE file. 2 package org.openstreetmap.josm.gui.tagging ;2 package org.openstreetmap.josm.gui.tagging.presets; 3 3 4 4 import static org.junit.Assert.assertFalse; … … 18 18 import org.openstreetmap.josm.data.osm.OsmUtils; 19 19 import org.openstreetmap.josm.data.osm.Way; 20 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetSelector.PresetClassification; 21 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetSelector.PresetClassifications; 20 22 import org.openstreetmap.josm.tools.Utils; 21 23 import org.xml.sax.SAXException; 22 24 25 /** 26 * Unit tests of {@link PresetClassifications} class. 27 */ 23 28 public class PresetClassificationsTest { 24 29 25 static final TaggingPresetSelector.PresetClassifications classifications = new TaggingPresetSelector.PresetClassifications();30 static final PresetClassifications classifications = new PresetClassifications(); 26 31 27 32 /** 28 33 * Setup test. 34 * @throws SAXException if any XML error occurs 35 * @throws IOException if any I/O error occurs 29 36 */ 30 37 @BeforeClass … … 35 42 } 36 43 37 private List< TaggingPresetSelector.PresetClassification> getMatchingPresets(String searchText, OsmPrimitive w) {44 private List<PresetClassification> getMatchingPresets(String searchText, OsmPrimitive w) { 38 45 return classifications.getMatchingPresets(searchText, true, true, EnumSet.of(TaggingPresetType.forPrimitive(w)), 39 46 Collections.singleton(w)); … … 41 48 42 49 private List<String> getMatchingPresetNames(String searchText, OsmPrimitive w) { 43 return Utils.transform(getMatchingPresets(searchText, w), new Utils.Function< TaggingPresetSelector.PresetClassification, String>() {50 return Utils.transform(getMatchingPresets(searchText, w), new Utils.Function<PresetClassification, String>() { 44 51 @Override 45 public String apply( TaggingPresetSelector.PresetClassification x) {52 public String apply(PresetClassification x) { 46 53 return x.preset.name; 47 54 } … … 49 56 } 50 57 58 /** 59 * Test building preset. 60 */ 51 61 @Test 52 public void testBuilding() throws Exception{62 public void testBuilding() { 53 63 final Way w = new Way(); 54 64 final Node n1 = new Node(); … … 61 71 } 62 72 73 /** 74 * Test public transport tram relations presets. 75 */ 63 76 @Test 64 77 public void testRelationsForTram() { -
trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReaderTest.java
r8862 r8863 1 1 // License: GPL. For details, see LICENSE file. 2 package org.openstreetmap.josm.gui.tagging ;2 package org.openstreetmap.josm.gui.tagging.presets; 3 3 4 4 import static org.CustomMatchers.hasSize; … … 15 15 import org.openstreetmap.josm.JOSMFixture; 16 16 import org.openstreetmap.josm.TestUtils; 17 import org.openstreetmap.josm.gui.tagging.presets.items.Check; 18 import org.openstreetmap.josm.gui.tagging.presets.items.Key; 17 19 import org.openstreetmap.josm.tools.Utils; 18 20 import org.xml.sax.SAXException; … … 33 35 /** 34 36 * #8954 - last checkbox in the preset is not added 37 * @throws SAXException if any XML error occurs 38 * @throws IOException if any I/O error occurs 35 39 */ 36 40 @Test … … 42 46 Assert.assertEquals("Number of entries", 1, preset.data.size()); 43 47 final TaggingPresetItem item = preset.data.get(0); 44 Assert.assertTrue("Entry is not checkbox", item instanceof TaggingPresetItems.Check);48 Assert.assertTrue("Entry is not checkbox", item instanceof Check); 45 49 } 46 50 51 /** 52 * Test nested chunks 53 * @throws SAXException if any XML error occurs 54 * @throws IOException if any I/O error occurs 55 */ 47 56 @Test 48 public void testNestedChunks() throws Exception {57 public void testNestedChunks() throws SAXException, IOException { 49 58 final Collection<TaggingPreset> presets = TaggingPresetReader.readAll(TestUtils.getTestDataRoot() + "preset_chunk.xml", true); 50 59 assertThat(presets, hasSize(1)); … … 53 62 @Override 54 63 public String apply(TaggingPresetItem x) { 55 return (( TaggingPresetItems.Key) x).key;64 return ((Key) x).key; 56 65 } 57 66 }); … … 62 71 * Validate internal presets 63 72 * See #9027 73 * @throws SAXException if any XML error occurs 74 * @throws IOException if any I/O error occurs 64 75 */ 65 76 @Test
Note:
See TracChangeset
for help on using the changeset viewer.