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


Ignore:
Timestamp:
2019-09-19T16:01:03+02:00 (5 years ago)
Author:
Don-vip
Message:

fix #18088 - see #18006 - Allow splitting a connectivity/restriction relation with multiple via-ways

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/command/SplitWayCommandTest.java

    r14134 r15362  
    33
    44import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNull;
    65import static org.junit.Assert.assertTrue;
    76
    87import java.util.ArrayList;
    98import java.util.Arrays;
     9import java.util.Collections;
    1010import java.util.Iterator;
    1111
     
    3838
    3939    /**
    40      * Unit test of {@link SplitWayCommand#findVia}.
     40     * Unit test of {@link SplitWayCommand#findVias}.
    4141     */
    4242    @Test
    43     public void testFindVia() {
     43    public void testFindVias() {
    4444        // empty relation
    45         assertNull(SplitWayCommand.findVia(new Relation(), null));
     45        assertTrue(SplitWayCommand.findVias(new Relation(), null).isEmpty());
    4646        // restriction relation without via member
    4747        Relation r = new Relation();
    4848        r.addMember(new RelationMember("", new Node()));
    49         assertNull(SplitWayCommand.findVia(r, "restriction"));
     49        assertTrue(SplitWayCommand.findVias(r, "restriction").isEmpty());
    5050        // restriction relation with via member
    5151        r = new Relation();
    5252        OsmPrimitive via = new Node();
    5353        r.addMember(new RelationMember("via", via));
    54         assertEquals(via, SplitWayCommand.findVia(r, "restriction"));
     54        assertEquals(Collections.singletonList(via), SplitWayCommand.findVias(r, "restriction"));
    5555        // destination_sign relation without sign nor intersection
    5656        r = new Relation();
    5757        r.addMember(new RelationMember("", new Node()));
    58         assertNull(SplitWayCommand.findVia(r, "destination_sign"));
     58        assertTrue(SplitWayCommand.findVias(r, "destination_sign").isEmpty());
    5959        // destination_sign with sign
    6060        r = new Relation();
    6161        via = new Node();
    6262        r.addMember(new RelationMember("sign", via));
    63         assertEquals(via, SplitWayCommand.findVia(r, "destination_sign"));
     63        assertEquals(Collections.singletonList(via), SplitWayCommand.findVias(r, "destination_sign"));
    6464        // destination_sign with intersection
    6565        r = new Relation();
    6666        via = new Node();
    6767        r.addMember(new RelationMember("intersection", via));
    68         assertEquals(via, SplitWayCommand.findVia(r, "destination_sign"));
     68        assertEquals(Collections.singletonList(via), SplitWayCommand.findVias(r, "destination_sign"));
    6969    }
    7070
Note: See TracChangeset for help on using the changeset viewer.