Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java
r7798 r8257 67 67 final OsmPrimitive p = "n".equals(x[0]) || "node".equals(x[0]) 68 68 ? new Node(LatLon.ZERO) 69 : "w".equals(x[0]) || "way".equals(x[0]) 69 : "w".equals(x[0]) || "way".equals(x[0]) || /*for MapCSS related usage*/ "area".equals(x[0]) 70 70 ? new Way() 71 71 : "r".equals(x[0]) || "relation".equals(x[0]) … … 73 73 : null; 74 74 if (p == null) { 75 throw new IllegalArgumentException("Expecting n/node/w/way/r/relation , but got " + x[0]);75 throw new IllegalArgumentException("Expecting n/node/w/way/r/relation/area, but got '" + x[0] + "'"); 76 76 } 77 77 for (final Map.Entry<String, String> i : TextTagParser.readTagsFromText(x[1]).entrySet()) { -
trunk/test/unit/org/openstreetmap/josm/TestUtils.java
r7937 r8257 2 2 package org.openstreetmap.josm; 3 3 4 import static org.hamcrest.CoreMatchers.is;5 import static org.junit.Assert.assertThat;6 import static org.junit.Assert.assertTrue;7 4 import static org.junit.Assert.fail; 8 5 9 6 import java.util.Arrays; 10 7 import java.util.Comparator; 11 12 import org.junit.Test;13 import org.openstreetmap.josm.data.osm.OsmPrimitive;14 import org.openstreetmap.josm.data.osm.OsmUtils;15 import org.openstreetmap.josm.data.osm.Way;16 8 17 9 /** … … 50 42 public static String getRegressionDataFile(int ticketid, String filename) { 51 43 return getRegressionDataDir(ticketid) + '/' + filename; 52 }53 54 @Test55 public void testCreatePrimitive() throws Exception {56 final OsmPrimitive p = OsmUtils.createPrimitive("way name=Foo railway=rail");57 assertTrue(p instanceof Way);58 assertThat(p.keySet().size(), is(2));59 assertThat(p.get("name"), is("Foo"));60 assertThat(p.get("railway"), is("rail"));61 }62 63 @Test(expected = IllegalArgumentException.class)64 public void testCreatePrimitiveFail() throws Exception {65 OsmUtils.createPrimitive("noway name=Foo");66 44 } 67 45
Note:
See TracChangeset
for help on using the changeset viewer.