Changeset 36064 in osm for applications/editors/josm/plugins/alignways/test/unit
- Timestamp:
- 2023-03-21T14:49:10+01:00 (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/alignways/test/unit/org/openstreetmap/josm/plugins/alignways/geometry/AlignWaysGeomLineTest.java
r34489 r36064 2 2 package org.openstreetmap.josm.plugins.alignways.geometry; 3 3 4 import static org.junit.Assert.assertTrue;5 4 6 import org.junit.Before; 7 import org.junit.Test; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertSame; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 9 import org.junit.jupiter.api.BeforeEach; 10 import org.junit.jupiter.api.Test; 8 11 import org.openstreetmap.josm.plugins.alignways.geometry.AlignWaysGeomLine.IntersectionStatus; 9 12 … … 11 14 * Tests of {@link AlignWaysGeomLine} 12 15 */ 13 publicclass AlignWaysGeomLineTest {16 class AlignWaysGeomLineTest { 14 17 private AlignWaysGeomLine line_x1y1x2y2, line_par_x1y1x2y2; 15 18 private AlignWaysGeomLine line_abc; … … 18 21 private AlignWaysGeomLine line_horiz, line_vert; 19 22 20 @Before 21 publicvoid setUp() {23 @BeforeEach 24 void setUp() { 22 25 line_x1y1x2y2 = new AlignWaysGeomLine(-2.0, -1.0, 4.0, 3.0); 23 26 line_abc = new AlignWaysGeomLine(2.0/3, -1.0, 1.0/3); … … 30 33 31 34 @Test 32 public voidLineLineEquiv() {33 assert True(line_x1y1x2y2.equals(line_line));35 void testLineLineEquiv() { 36 assertEquals(line_x1y1x2y2, line_line); 34 37 } 35 38 36 39 @Test 37 public voidLineAbcLineEquiv() {38 assert True(line_x1y1x2y2.equals(line_abc));40 void testLineAbcLineEquiv() { 41 assertEquals(line_x1y1x2y2, line_abc); 39 42 } 40 43 41 44 @Test 42 public voidLineMbLineEquiv() {43 assert True(line_x1y1x2y2.equals(line_mb));45 void testLineMbLineEquiv() { 46 assertEquals(line_x1y1x2y2, line_mb); 44 47 } 45 48 46 49 @Test 47 public voidLineAbcMbEquiv() {48 assert True(line_abc.equals(line_mb));50 void testLineAbcMbEquiv() { 51 assertEquals(line_abc, line_mb); 49 52 } 50 53 51 54 @Test 52 public voidLineLineParallel() {55 void testLineLineParallel() { 53 56 line_x1y1x2y2.getIntersection(line_par_x1y1x2y2); 54 assert True(line_x1y1x2y2.getIntersectionStatus() ==IntersectionStatus.LINES_PARALLEL);57 assertSame(line_x1y1x2y2.getIntersectionStatus(), IntersectionStatus.LINES_PARALLEL); 55 58 } 56 59 57 60 @Test 58 public voidLineAbcOverlap() {61 void testLineAbcOverlap() { 59 62 line_x1y1x2y2.getIntersection(line_abc); 60 assert True(line_x1y1x2y2.getIntersectionStatus() ==IntersectionStatus.LINES_OVERLAP);63 assertSame(line_x1y1x2y2.getIntersectionStatus(), IntersectionStatus.LINES_OVERLAP); 61 64 } 62 65 63 66 @Test 64 public voidLineMbOverlap() {67 void testLineMbOverlap() { 65 68 line_x1y1x2y2.getIntersection(line_mb); 66 assert True(line_x1y1x2y2.getIntersectionStatus() ==IntersectionStatus.LINES_OVERLAP);69 assertSame(line_x1y1x2y2.getIntersectionStatus(), IntersectionStatus.LINES_OVERLAP); 67 70 } 68 71 69 72 @Test 70 public voidAbcMbOverlap() {73 void testAbcMbOverlap() { 71 74 line_abc.getIntersection(line_mb); 72 assert True(line_abc.getIntersectionStatus() ==IntersectionStatus.LINES_OVERLAP);75 assertSame(line_abc.getIntersectionStatus(), IntersectionStatus.LINES_OVERLAP); 73 76 } 74 77 75 78 @Test 76 public voidGetXOnHoriz() {79 void testGetXOnHoriz() { 77 80 assertTrue(line_horiz.getXonLine(2.0).isNaN()); 78 81 } 79 82 80 83 @Test 81 public voidGetYOnVert() {84 void testGetYOnVert() { 82 85 assertTrue(line_vert.getYonLine(2.0).isNaN()); 83 86 } 84 87 85 88 @Test 86 public void StatusUndefAfterConstruct() throws Exception{89 void testStatusUndefAfterConstruct() { 87 90 AlignWaysGeomLine newLine = new AlignWaysGeomLine(1.0, 2.0); 88 assertTrue(newLine.getIntersectionStatus() == IntersectionStatus.UNDEFINED); 89 91 assertSame(newLine.getIntersectionStatus(), IntersectionStatus.UNDEFINED); 90 92 } 91 93
Note:
See TracChangeset
for help on using the changeset viewer.