Changeset 11282 in josm for trunk/test/unit/org


Ignore:
Timestamp:
2016-11-18T18:27:07+01:00 (8 years ago)
Author:
simon04
Message:

Fix OsmLinkPasterTest due to r11279

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/importers/OsmLinkPasterTest.java

    r10881 r11282  
    22package org.openstreetmap.josm.gui.datatransfer.importers;
    33
    4 import static org.junit.Assert.assertArrayEquals;
     4import static org.junit.Assert.assertEquals;
     5import static org.junit.Assert.assertNull;
    56
    67import org.junit.Rule;
    78import org.junit.Test;
    8 import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    9 import org.openstreetmap.josm.data.osm.SimplePrimitiveId;
     9import org.openstreetmap.josm.data.coor.LatLon;
    1010import org.openstreetmap.josm.testutils.JOSMTestRules;
    1111
     
    2525
    2626    /**
    27      * Test of {@link OsmLinkPaster#parseIds(String)}
     27     * Test of {@link OsmLinkPaster#parseLatLon(String)}
    2828     */
    2929    @Test
    30     public void testParseIds() {
    31         assertArrayEquals(new Object[] {new SimplePrimitiveId(1234, OsmPrimitiveType.NODE) },
    32                 OsmLinkPaster.parseIds("http://www.openstreetmap.org/node/1234").toArray());
    33         assertArrayEquals(new Object[] {new SimplePrimitiveId(1234, OsmPrimitiveType.WAY) },
    34                 OsmLinkPaster.parseIds("http://www.openstreetmap.org/way/1234").toArray());
    35         assertArrayEquals(new Object[] {new SimplePrimitiveId(1234, OsmPrimitiveType.RELATION) },
    36                 OsmLinkPaster.parseIds("http://www.openstreetmap.org/relation/1234").toArray());
    37 
    38         assertArrayEquals(new Object[] {new SimplePrimitiveId(1234, OsmPrimitiveType.NODE) },
    39                 OsmLinkPaster.parseIds("http://www.osm.org/node/1234").toArray());
    40         assertArrayEquals(new Object[] {new SimplePrimitiveId(1234, OsmPrimitiveType.WAY) },
    41                 OsmLinkPaster.parseIds("http://osm.org/way/1234").toArray());
    42         assertArrayEquals(new Object[] {new SimplePrimitiveId(1234, OsmPrimitiveType.RELATION) },
    43                 OsmLinkPaster.parseIds("https://www.openstreetmap.org/relation/1234").toArray());
    44 
    45         assertArrayEquals(new Object[0], OsmLinkPaster.parseIds("http://www.openstreetmap.org/xx/1234").toArray());
    46         assertArrayEquals(new Object[0], OsmLinkPaster.parseIds("http://www.openstreetmap.org/way/1234x").toArray());
    47         assertArrayEquals(new Object[0], OsmLinkPaster.parseIds("").toArray());
     30    public void testParseLatLon() {
     31        assertEquals(new LatLon(51.71873, 8.76164),
     32                OsmLinkPaster.parseLatLon("https://www.openstreetmap.org/#map=17/51.71873/8.76164"));
     33        assertNull(OsmLinkPaster.parseLatLon("http://www.openstreetmap.org/"));
     34        assertNull(OsmLinkPaster.parseLatLon("foo-bar"));
    4835    }
    4936}
Note: See TracChangeset for help on using the changeset viewer.