1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.actions.corrector;
|
---|
3 |
|
---|
4 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
---|
5 |
|
---|
6 | import org.junit.jupiter.api.extension.RegisterExtension;
|
---|
7 | import org.junit.jupiter.api.Test;
|
---|
8 | import org.openstreetmap.josm.data.osm.Tag;
|
---|
9 | import org.openstreetmap.josm.data.osm.Tagged;
|
---|
10 | import org.openstreetmap.josm.data.osm.Way;
|
---|
11 | import org.openstreetmap.josm.testutils.JOSMTestRules;
|
---|
12 |
|
---|
13 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * Unit tests of {@link ReverseWayNoTagCorrector} class.
|
---|
17 | */
|
---|
18 | class ReverseWayNoTagCorrectorTest {
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Setup test.
|
---|
22 | */
|
---|
23 | @RegisterExtension
|
---|
24 | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
---|
25 | public JOSMTestRules test = new JOSMTestRules();
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * Tests the {@link ReverseWayNoTagCorrector#getDirectionalTags} function
|
---|
29 | */
|
---|
30 | @Test
|
---|
31 | void testDirectionalTags() {
|
---|
32 | assertEquals(1, ReverseWayNoTagCorrector.getDirectionalTags(new Tag("waterway", "drain")).size());
|
---|
33 | assertEquals(1, ReverseWayNoTagCorrector.getDirectionalTags(new Tag("man_made", "embankment")).size());
|
---|
34 | assertEquals(1, ReverseWayNoTagCorrector.getDirectionalTags(new Tag("aerialway", "drag_lift")).size());
|
---|
35 | assertEquals(0, ReverseWayNoTagCorrector.getDirectionalTags(new Tag("aerialway", "station")).size());
|
---|
36 | assertEquals(0, ReverseWayNoTagCorrector.getDirectionalTags(new Tag("incline", "up")).size());
|
---|
37 | assertEquals(0, ReverseWayNoTagCorrector.getDirectionalTags(new Tag("oneway", "yes")).size());
|
---|
38 | assertEquals(1, ReverseWayNoTagCorrector.getDirectionalTags(new Tag("barrier", "kerb")).size());
|
---|
39 | assertEquals(1, ReverseWayNoTagCorrector.getDirectionalTags(new Tag("barrier", "city_wall")).size());
|
---|
40 |
|
---|
41 | final Tagged twoSidedCityWall = new Way();
|
---|
42 | twoSidedCityWall.put("barrier", "city_wall");
|
---|
43 | twoSidedCityWall.put("two_sided", "yes");
|
---|
44 | assertEquals(0, ReverseWayNoTagCorrector.getDirectionalTags(twoSidedCityWall).size());
|
---|
45 | }
|
---|
46 | }
|
---|