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


Ignore:
Timestamp:
2017-01-07T17:15:00+01:00 (7 years ago)
Author:
Don-vip
Message:

fix #14186 - ConcurrentModificationException in QuadBucketIterator after conflict resolution (patch by GerdP, modified)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetTest.java

    r11115 r11440  
    22package org.openstreetmap.josm.data.osm;
    33
     4import java.util.Arrays;
     5import java.util.List;
     6
     7import org.junit.Assert;
    48import org.junit.Rule;
    59import org.junit.Test;
    6 import org.junit.Assert;
     10import org.openstreetmap.josm.data.coor.LatLon;
    711import org.openstreetmap.josm.testutils.JOSMTestRules;
    812
    913import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    10 import java.util.List;
    11 import org.openstreetmap.josm.data.coor.LatLon;
    1214
    1315/**
     
    3436            ds.searchRelations(null).isEmpty()
    3537        );
    36        
     38
    3739        // empty data set, any bbox => empty list
    38         BBox bbox = new BBox(LatLon.NORTH_POLE, LatLon.SOUTH_POLE);
     40        BBox bbox = new BBox(new LatLon(-180, -90), new LatLon(180, 90));
    3941        Assert.assertTrue(
    4042            "Empty data set should produce an empty list.",
    4143            ds.searchRelations(bbox).isEmpty()
    4244        );
    43        
     45
    4446        // data set with elements in the given bbox => these elements
    4547        Node node = new Node(LatLon.ZERO);
     
    5355        Assert.assertEquals("We should have found only one item.", 1, result.size());
    5456        Assert.assertTrue("The item found is relation r.", result.contains(r));
    55        
     57    }
     58
     59    /**
     60     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/14186">Bug #14186</a>.
     61     */
     62    @Test
     63    public void testTicket14186() {
     64        final DataSet ds = new DataSet();
     65        Node n1 = new Node(1);
     66        Node n2 = new Node(2);
     67        Node n3 = new Node(3);
     68        Way w1 = new Way(1);
     69        w1.setNodes(Arrays.asList(n1, n2, n3));
     70        Way w2 = new Way(2);
     71        w2.setNodes(Arrays.asList(n1, n2, n3));
     72        ds.addPrimitive(n1);
     73        ds.addPrimitive(n2);
     74        ds.addPrimitive(n3);
     75        ds.addPrimitive(w1);
     76        ds.addPrimitive(w2);
     77        ds.unlinkNodeFromWays(n2);
    5678    }
    5779}
Note: See TracChangeset for help on using the changeset viewer.