Changeset 15134 in josm


Ignore:
Timestamp:
2019-05-28T22:03:17+02:00 (5 years ago)
Author:
GerdP
Message:

see #17765: fix / add unit tests

Location:
trunk/test/unit/org/openstreetmap/josm/data/validation/tests
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MultipolygonTestTest.java

    r14138 r15134  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
    7 
    8 import java.util.ArrayList;
    9 import java.util.List;
    104import java.util.stream.Collectors;
    115
    126import org.junit.Rule;
    137import org.junit.Test;
    14 import org.openstreetmap.josm.data.coor.LatLon;
    15 import org.openstreetmap.josm.data.osm.Node;
    16 import org.openstreetmap.josm.data.osm.OsmUtils;
    178import org.openstreetmap.josm.data.osm.Relation;
    18 import org.openstreetmap.josm.data.osm.Way;
    19 import org.openstreetmap.josm.gui.mappaint.ElemStyles;
    209import org.openstreetmap.josm.testutils.JOSMTestRules;
    2110
     
    3726    public JOSMTestRules test = new JOSMTestRules().projection().mapStyles().presets().main();
    3827
    39     private static Way createUnclosedWay(String tags) {
    40         List<Node> nodes = new ArrayList<>();
    41         nodes.add(new Node(new LatLon(0, 1)));
    42         nodes.add(new Node(new LatLon(0, 2)));
    43 
    44         Way w = (Way) OsmUtils.createPrimitive("way "+tags);
    45         w.setNodes(nodes);
    46         return w;
    47     }
    48 
    49     /**
    50      * Non-regression test for bug #10469.
    51      * @throws Exception if an exception occurs
    52      */
    53     @Test
    54     public void testTicket10469() throws Exception {
    55         MULTIPOLYGON_TEST.initialize();
    56         MULTIPOLYGON_TEST.startTest(null);
    57 
    58         // Erroneous tag
    59         Way w = createUnclosedWay("amenity=parking");
    60         MULTIPOLYGON_TEST.visit(w);
    61         assertTrue(ElemStyles.hasAreaElemStyle(w, false));
    62         assertEquals(1, MULTIPOLYGON_TEST.getErrors().size());
    63 
    64         // Erroneous tag, but managed by another test
    65         w = createUnclosedWay("building=yes");
    66         MULTIPOLYGON_TEST.visit(w);
    67         assertTrue(ElemStyles.hasAreaElemStyle(w, false));
    68         assertEquals(1, MULTIPOLYGON_TEST.getErrors().size());
    69 
    70         // Correct tag, without area style since #10601 (r7603)
    71         w = createUnclosedWay("aeroway=taxiway");
    72         MULTIPOLYGON_TEST.visit(w);
    73         assertFalse(ElemStyles.hasAreaElemStyle(w, false));
    74         assertEquals(1, MULTIPOLYGON_TEST.getErrors().size());
    75 
    76         MULTIPOLYGON_TEST.endTest();
    77     }
    78 
    7928    /**
    8029     * Test all error cases manually created in multipolygon.osm.
Note: See TracChangeset for help on using the changeset viewer.