Changeset 16547 in josm for trunk/test/unit


Ignore:
Timestamp:
2020-06-07T11:48:36+02:00 (4 years ago)
Author:
simon04
Message:

Revert "Simplify QuadBucketsTest"

Tests iterator implementation.

File:
1 edited

Legend:

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

    r16543 r16547  
    5353        for (OsmPrimitive o: allNodes) {
    5454            ds.removePrimitive(o);
    55             Assert.assertEquals(--expectedCount, nodes.size());
     55            checkIterator(nodes, --expectedCount);
    5656        }
    5757        expectedCount = allWays.size();
    5858        for (OsmPrimitive o: allWays) {
    5959            ds.removePrimitive(o);
    60             Assert.assertEquals(--expectedCount, ways.size());
     60            checkIterator(ways, --expectedCount);
    6161        }
    6262        for (OsmPrimitive o: allRelations) {
     
    6666        Assert.assertTrue(ways.isEmpty());
    6767        Assert.assertTrue(relations.isEmpty());
     68    }
     69
     70    private void checkIterator(Iterable<? extends OsmPrimitive> col, int expectedCount) {
     71        int count = 0;
     72        Iterator<? extends OsmPrimitive> it = col.iterator();
     73        while (it.hasNext()) {
     74            count++;
     75            it.next();
     76        }
     77        Assert.assertEquals(expectedCount, count);
    6878    }
    6979
Note: See TracChangeset for help on using the changeset viewer.