Changeset 11886 in josm


Ignore:
Timestamp:
2017-04-11T23:41:13+02:00 (4 months ago)
Author:
Don-vip
Message:

see #14635 - add a new unit test (not directly related to the bug)

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculator.java

    r11746 r11886  
    135135    private int firstGroupIdx;
    136136    private void makeLoopIfNeeded(final List<WayConnectionType> con, final int i) {
    137         boolean loop;
     137        boolean loop = false;
    138138        if (i == firstGroupIdx) { //is primitive loop
    139139            loop = determineDirection(i, FORWARD, i) == FORWARD;
    140         } else {
     140        } else if (i >= 0) {
    141141            loop = determineDirection(i, con.get(i).direction, firstGroupIdx) == con.get(firstGroupIdx).direction;
    142142        }
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculatorTest.java

    r10876 r11886  
    55import java.io.IOException;
    66import java.io.InputStream;
     7import java.util.ArrayList;
    78import java.util.Arrays;
    89import java.util.List;
     
    9798
    9899    @Test
     100    public void testEmpty() {
     101        String actual = getConnections(wayConnectionTypeCalculator.updateLinks(new ArrayList<>()));
     102        Assert.assertEquals("[]", actual);
     103    }
     104
     105    @Test
    99106    public void testGeneric() {
    100107        Relation relation = getRelation("generic");
Note: See TracChangeset for help on using the changeset viewer.