Changeset 18675 in josm for trunk/test
- Timestamp:
- 2023-02-22T19:14:00+01:00 (21 months ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/PowerLinesTest.java
r18553 r18675 2 2 package org.openstreetmap.josm.data.validation.tests; 3 3 4 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; 4 5 import static org.junit.jupiter.api.Assertions.assertFalse; 5 6 import static org.junit.jupiter.api.Assertions.assertTrue; … … 7 8 import org.junit.jupiter.api.BeforeEach; 8 9 import org.junit.jupiter.api.Test; 9 import org. junit.jupiter.api.extension.RegisterExtension;10 import org.openstreetmap.josm.TestUtils; 10 11 import org.openstreetmap.josm.data.coor.LatLon; 11 12 import org.openstreetmap.josm.data.osm.DataSet; 12 13 import org.openstreetmap.josm.data.osm.Node; 14 import org.openstreetmap.josm.data.osm.Relation; 15 import org.openstreetmap.josm.data.osm.RelationMember; 13 16 import org.openstreetmap.josm.data.osm.TagMap; 14 17 import org.openstreetmap.josm.data.osm.Way; 15 import org.openstreetmap.josm.testutils.JOSMTestRules;16 18 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 19 import org.openstreetmap.josm.testutils.annotations.Projection; 17 20 18 21 /** … … 21 24 */ 22 25 @BasicPreferences 26 @Projection 23 27 class PowerLinesTest { 24 28 private PowerLines powerLines; 25 29 private DataSet ds; 26 27 @RegisterExtension28 static JOSMTestRules josmTestRules = new JOSMTestRules().projection();29 30 30 31 @BeforeEach … … 119 120 assertFalse(powerLines.getErrors().isEmpty()); 120 121 } 122 123 /** 124 * Ensure that incomplete relations don't cause problems 125 */ 126 @Test 127 void testNonRegression22684() { 128 final Relation powerLine = TestUtils.newRelation("natural=water water=river", 129 new RelationMember("", TestUtils.newWay("", new Node(), new Node()))); 130 assertDoesNotThrow(() -> this.powerLines.visit(powerLine)); 131 } 121 132 } -
trunk/test/unit/org/openstreetmap/josm/tools/GeometryTest.java
r18590 r18675 2 2 package org.openstreetmap.josm.tools; 3 3 4 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; 4 5 import static org.junit.jupiter.api.Assertions.assertEquals; 5 6 import static org.junit.jupiter.api.Assertions.assertFalse; 6 7 import static org.junit.jupiter.api.Assertions.assertNotEquals; 7 8 import static org.junit.jupiter.api.Assertions.assertNotNull; 9 import static org.junit.jupiter.api.Assertions.assertNull; 8 10 import static org.junit.jupiter.api.Assertions.assertTrue; 9 11 … … 18 20 import java.util.stream.Stream; 19 21 20 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;21 22 import org.junit.jupiter.api.Test; 22 import org.junit.jupiter.api.extension.RegisterExtension;23 23 import org.junit.jupiter.params.ParameterizedTest; 24 24 import org.junit.jupiter.params.provider.Arguments; … … 39 39 import org.openstreetmap.josm.data.projection.Projections; 40 40 import org.openstreetmap.josm.io.OsmReader; 41 import org.openstreetmap.josm.testutils. JOSMTestRules;41 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 42 42 43 43 /** 44 44 * Unit tests of {@link Geometry} class. 45 45 */ 46 @BasicPreferences 47 @org.openstreetmap.josm.testutils.annotations.Projection 46 48 class GeometryTest { 47 /**48 * Primitives need preferences and projection.49 */50 @RegisterExtension51 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")52 static JOSMTestRules test = new JOSMTestRules().preferences().projection();53 54 49 /** 55 50 * Test of {@link Geometry#getLineLineIntersection} method. … … 578 573 assertEquals(angle, Math.toDegrees(original.bearing(actual)), 0.000_001); 579 574 } 575 576 /** 577 * A non-regression test for an issue found during the investigation of #22684 (see comment:3 by GerdP) 578 */ 579 @Test 580 void testNonRegression22684() { 581 final EastNorth centroid1 = assertDoesNotThrow(() -> Geometry.getCentroid(Collections.singletonList(new Node()))); 582 assertNull(centroid1); 583 final EastNorth centroid2 = assertDoesNotThrow(() -> Geometry.getCentroid(Arrays.asList(new Node(LatLon.ZERO), new Node()))); 584 assertTrue(new EastNorth(0, 0).equalsEpsilon(centroid2, 1e-9)); 585 final EastNorth centroid3 = assertDoesNotThrow( 586 () -> Geometry.getCentroid(Arrays.asList(new Node(LatLon.ZERO), new Node(), new Node(LatLon.ZERO)))); 587 assertTrue(new EastNorth(0, 0).equalsEpsilon(centroid3, 1e-9)); 588 } 580 589 }
Note:
See TracChangeset
for help on using the changeset viewer.