Ignore:
Timestamp:
2020-01-13T21:45:26+01:00 (5 years ago)
Author:
simon04
Message:

JOSM/comfort0: parse relations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/comfort0/test/unit/net/simon04/comfort0/level0l/parsergen/Level0LParserTest.java

    r35285 r35288  
    88import org.junit.Test;
    99import org.openstreetmap.josm.data.osm.NodeData;
     10import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
     11import org.openstreetmap.josm.data.osm.RelationData;
    1012import org.openstreetmap.josm.data.osm.WayData;
    1113
     
    4547        assertThat(way.getKeys().get("name"), is("Pastower Straße"));
    4648    }
     49
     50    @Test
     51    public void testRelation() throws Exception {
     52        final String level0l = "" +
     53                "relation 56688 # member types: nd, wy, rel; roles are put after ids\n" +
     54                "  nd 294942404\n" +
     55                "  nd 364933006 # the second node\n" +
     56                "  wy 4579143 forward\n" +
     57                "  nd 249673494 stop # the end\n" +
     58                "  name = Küstenbus Linie 123\n" +
     59                "  network = VVW\n" +
     60                "  operator = Regionalverkehr Küste\n" +
     61                "  ref = 123\n" +
     62                "  route = bus\n" +
     63                "  type = route\n";
     64        final RelationData relation = new Level0LParser(new StringReader(level0l)).relation();
     65        assertThat(relation.getId(), is(56688L));
     66        assertThat(relation.getMembersCount(), is(4));
     67        assertThat(relation.getMembers().get(0).getMemberId(), is(294942404L));
     68        assertThat(relation.getMembers().get(0).getMemberType(), is(OsmPrimitiveType.NODE));
     69        assertThat(relation.getMembers().get(0).getRole(), is(""));
     70        assertThat(relation.getMembers().get(2).getMemberId(), is(4579143L));
     71        assertThat(relation.getMembers().get(2).getMemberType(), is(OsmPrimitiveType.WAY));
     72        assertThat(relation.getMembers().get(2).getRole(), is("forward"));
     73        assertThat(relation.getKeys().size(), is(6));
     74    }
    4775}
Note: See TracChangeset for help on using the changeset viewer.