Changeset 10657 in josm for trunk/test


Ignore:
Timestamp:
2016-07-27T02:08:34+02:00 (3 years ago)
Author:
Don-vip
Message:

see #11390, see #12890 - use Java 8 Predicates

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.groovy

    r8811 r10657  
    1010import org.openstreetmap.josm.data.osm.Way
    1111import org.openstreetmap.josm.io.OsmReader
    12 import org.openstreetmap.josm.tools.Utils
     12import org.openstreetmap.josm.tools.SubclassFilteredCollection
    1313
    1414class CreateMultipolygonActionTest {
     
    4545    public void testCreate2() {
    4646        def ds = OsmReader.parseDataSet(new FileInputStream(TestUtils.getTestDataRoot() + "create_multipolygon.osm"), null);
    47         def ways = Utils.filter(ds.getWays(), SearchCompiler.compile("ref=1 OR ref:1.1."))
     47        def ways = SubclassFilteredCollection.filter(ds.getWays(), SearchCompiler.compile("ref=1 OR ref:1.1."))
    4848        def mp = CreateMultipolygonAction.createMultipolygonCommand(ways as Collection<Way>, null)
    4949        assert getRefToRoleMap(mp.b).toString() == "[1:outer, 1.1.1:inner, 1.1.2:inner]"
     
    5353    public void testUpdate1() {
    5454        def ds = OsmReader.parseDataSet(new FileInputStream(TestUtils.getTestDataRoot() + "create_multipolygon.osm"), null);
    55         def ways = Utils.filter(ds.getWays(), SearchCompiler.compile(regexpSearch("ref=\".*1\$\"")))
     55        def ways = SubclassFilteredCollection.filter(ds.getWays(), SearchCompiler.compile(regexpSearch("ref=\".*1\$\"")))
    5656        def mp = CreateMultipolygonAction.createMultipolygonCommand(ways as Collection<Way>, null)
    5757        assert mp.b.getMembersCount() == 3
    5858        assert getRefToRoleMap(mp.b).toString() == "[1:outer, 1.1:inner, 1.1.1:outer]"
    59         def ways2 = Utils.filter(ds.getWays(), SearchCompiler.compile(regexpSearch("ref=1.2")))
     59        def ways2 = SubclassFilteredCollection.filter(ds.getWays(), SearchCompiler.compile(regexpSearch("ref=1.2")))
    6060        def mp2 = CreateMultipolygonAction.createMultipolygonCommand(ways2 as Collection<Way>, mp.b)
    6161        assert mp2.b.getMembersCount() == 4
     
    6666    public void testUpdate2() {
    6767        def ds = OsmReader.parseDataSet(new FileInputStream(TestUtils.getTestDataRoot() + "create_multipolygon.osm"), null);
    68         def ways = Utils.filter(ds.getWays(), SearchCompiler.compile("ref=1 OR ref:1.1.1"))
     68        def ways = SubclassFilteredCollection.filter(ds.getWays(), SearchCompiler.compile("ref=1 OR ref:1.1.1"))
    6969        def mp = CreateMultipolygonAction.createMultipolygonCommand(ways as Collection<Way>, null)
    7070        assert getRefToRoleMap(mp.b).toString() == "[1:outer, 1.1.1:inner]"
    71         def ways2 = Utils.filter(ds.getWays(), SearchCompiler.compile(regexpSearch("ref=1.1 OR ref=1.2 OR ref=1.1.2")))
     71        def ways2 = SubclassFilteredCollection.filter(ds.getWays(), SearchCompiler.compile(regexpSearch("ref=1.1 OR ref=1.2 OR ref=1.1.2")))
    7272        def mp2 = CreateMultipolygonAction.createMultipolygonCommand(ways2 as Collection<Way>, mp.b)
    7373        assert getRefToRoleMap(mp2.b).toString() == "[1:outer, 1.1:inner, 1.1.1:outer, 1.1.2:outer, 1.2:inner]"
  • trunk/test/unit/org/openstreetmap/josm/actions/OrthogonalizeActionTest.java

    r10378 r10657  
    2020import org.openstreetmap.josm.io.OsmReader;
    2121import org.openstreetmap.josm.tools.Geometry;
    22 import org.openstreetmap.josm.tools.Utils;
     22import org.openstreetmap.josm.tools.SubclassFilteredCollection;
    2323
    2424/**
     
    8787            final DataSet ds = OsmReader.parseDataSet(in, null);
    8888            for (String s : search) {
    89                 ds.addSelected(Utils.filter(ds.allPrimitives(), SearchCompiler.compile(s)));
     89                ds.addSelected(SubclassFilteredCollection.filter(ds.allPrimitives(), SearchCompiler.compile(s)));
    9090            }
    9191            OrthogonalizeAction.orthogonalize(ds.getSelected()).executeCommand();
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java

    r9335 r10657  
    7171        final Node n1 = new Node();
    7272        n1.put("natural", "marsh");
    73         assertTrue(check.evaluate(n1));
     73        assertTrue(check.test(n1));
    7474        assertEquals("natural=marsh is deprecated", check.getErrorForPrimitive(n1).getMessage());
    7575        assertEquals(Severity.WARNING, check.getErrorForPrimitive(n1).getSeverity());
     
    7878        final Node n2 = new Node();
    7979        n2.put("natural", "wood");
    80         assertFalse(check.evaluate(n2));
     80        assertFalse(check.test(n2));
    8181        assertEquals("The key is natural and the value is marsh",
    8282                MapCSSTagChecker.TagCheck.insertArguments(check.rule.selectors.get(0), "The key is {0.key} and the value is {0.value}", null));
  • trunk/test/unit/org/openstreetmap/josm/tools/GeometryTest.java

    r10553 r10657  
    7171        try (FileInputStream in = new FileInputStream(TestUtils.getTestDataRoot() + "create_multipolygon.osm")) {
    7272            DataSet ds = OsmReader.parseDataSet(in, null);
    73             Way closedWay = (Way) Utils.filter(ds.allPrimitives(), SearchCompiler.compile("landuse=forest")).iterator().next();
     73            Way closedWay = (Way) SubclassFilteredCollection.filter(ds.allPrimitives(),
     74                    SearchCompiler.compile("landuse=forest")).iterator().next();
    7475            Assert.assertEquals(5760015.7353515625, Geometry.closedWayArea(closedWay), 1e-3);
    7576            Assert.assertEquals(5760015.7353515625, Geometry.computeArea(closedWay), 1e-3);
     
    101102        try (FileInputStream in = new FileInputStream(TestUtils.getTestDataRoot() + "create_multipolygon.osm")) {
    102103            DataSet ds = OsmReader.parseDataSet(in, null);
    103             Way closedWay = (Way) Utils.filter(ds.allPrimitives(), SearchCompiler.compile("landuse=forest")).iterator().next();
     104            Way closedWay = (Way) SubclassFilteredCollection.filter(ds.allPrimitives(),
     105                    SearchCompiler.compile("landuse=forest")).iterator().next();
    104106            Geometry.AreaAndPerimeter areaAndPerimeter = Geometry.getAreaAndPerimeter(closedWay.getNodes());
    105107            Assert.assertEquals(12495000., areaAndPerimeter.getArea(), 1e-3);
Note: See TracChangeset for help on using the changeset viewer.