source: josm/trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/ConvertToDataLayerActionTest.java@ 11094

Last change on this file since 11094 was 11094, checked in by Don-vip, 8 years ago

fix unit test

File size: 1.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.layer.gpx;
3
4import static org.junit.Assert.assertEquals;
5
6import org.junit.BeforeClass;
7import org.junit.Test;
8import org.openstreetmap.josm.JOSMFixture;
9import org.openstreetmap.josm.TestUtils;
10import org.openstreetmap.josm.data.gpx.GpxData;
11import org.openstreetmap.josm.data.osm.DataSet;
12import org.openstreetmap.josm.data.osm.TagMap;
13import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
14import org.openstreetmap.josm.io.GpxReaderTest;
15
16/**
17 * Unit tests of {@link ConvertToDataLayerAction} class.
18 */
19public class ConvertToDataLayerActionTest {
20
21 /**
22 * Setup test.
23 */
24 @BeforeClass
25 public static void setUpBeforeClass() {
26 JOSMFixture.createUnitTestFixture().init(false);
27 }
28
29 /**
30 * Tests a conversion from a GPX marker layer to a OSM dataset
31 * @throws Exception if the parsing fails
32 */
33 @Test
34 public void testFromMarkerLayer() throws Exception {
35 final GpxData data = GpxReaderTest.parseGpxData(TestUtils.getTestDataRoot() + "minimal.gpx");
36 final MarkerLayer markers = new MarkerLayer(data, "Markers", data.storageFile, null);
37 final DataSet osm = new ConvertToDataLayerAction.FromMarkerLayer(markers).convert();
38 assertEquals(1, osm.getNodes().size());
39 assertEquals(new TagMap("name", "Schranke", "description", "Pfad", "note", "Pfad", "gpxicon", "Toll Booth"),
40 osm.getNodes().iterator().next().getKeys());
41 }
42}
Note: See TracBrowser for help on using the repository browser.