Changeset 8863 in josm for trunk/test/unit/org/openstreetmap/josm/gui/tagging
- Timestamp:
- 2015-10-12T22:58:25+02:00 (8 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets
- Files:
-
- 1 added
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
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.