Changeset 7112 in josm for trunk/test/unit/org/openstreetmap
- Timestamp:
- 2014-05-12T21:45:02+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/DefaultNameFormatterTest.java
r7109 r7112 2 2 package org.openstreetmap.josm.gui; 3 3 4 import static org.hamcrest.CoreMatchers.is; 5 import static org.junit.Assert.assertThat; 4 6 import static org.junit.Assert.assertTrue; 5 7 … … 17 19 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 18 20 import org.openstreetmap.josm.data.osm.Relation; 21 import org.openstreetmap.josm.data.osm.Way; 19 22 import org.openstreetmap.josm.gui.tagging.TaggingPresetReader; 20 23 import org.openstreetmap.josm.gui.tagging.TaggingPresets; … … 76 79 } 77 80 } 81 82 @Test 83 public void testRelationName() throws Exception { 84 assertThat(getFormattedRelationName("X=Y"), is("relation (0, 0 members)")); 85 assertThat(getFormattedRelationName("name=Foo"), is("relation (\"Foo\", 0 members)")); 86 assertThat(getFormattedRelationName("type=route route=tram ref=123"), is("route (\"123\", 0 members)")); 87 assertThat(getFormattedRelationName("type=multipolygon building=yes"), is("multipolygon (\"building\", 0 members)")); 88 assertThat(getFormattedRelationName("type=multipolygon building=yes ref=123"), is("multipolygon (\"123\", 0 members)")); 89 assertThat(getFormattedRelationName("type=multipolygon building=yes addr:housenumber=123"), is("multipolygon (\"building\", 0 members)")); 90 assertThat(getFormattedRelationName("type=multipolygon building=residential addr:housenumber=123"), is("multipolygon (\"residential\", 0 members)")); 91 } 92 93 @Test 94 public void testWayName() throws Exception { 95 assertThat(getFormattedWayName("building=yes"), is("building (0 nodes)")); 96 assertThat(getFormattedWayName("building=yes addr:housenumber=123"), is("House number 123 (0 nodes)")); 97 assertThat(getFormattedWayName("building=yes addr:housenumber=123 addr:street=FooStreet"), is("House number 123 at FooStreet (0 nodes)")); 98 assertThat(getFormattedWayName("building=yes addr:housenumber=123 addr:housename=FooName"), is("House FooName (0 nodes)")); 99 } 100 101 static String getFormattedRelationName(String tagsString) { 102 return DefaultNameFormatter.getInstance().format((Relation) TestUtils.createPrimitive("relation " + tagsString)); 103 } 104 105 static String getFormattedWayName(String tagsString) { 106 return DefaultNameFormatter.getInstance().format((Way) TestUtils.createPrimitive("way " + tagsString)); 107 } 78 108 }
Note:
See TracChangeset
for help on using the changeset viewer.