Ignore:
Timestamp:
2023-03-21T14:49:10+01:00 (22 months ago)
Author:
taylor.smock
Message:

See #16567: Convert most plugin tests to JUnit 5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/alignways/test/unit/org/openstreetmap/josm/plugins/alignways/geometry/AlignWaysGeomLineTest.java

    r34489 r36064  
    22package org.openstreetmap.josm.plugins.alignways.geometry;
    33
    4 import static org.junit.Assert.assertTrue;
    54
    6 import org.junit.Before;
    7 import org.junit.Test;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertSame;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
     8
     9import org.junit.jupiter.api.BeforeEach;
     10import org.junit.jupiter.api.Test;
    811import org.openstreetmap.josm.plugins.alignways.geometry.AlignWaysGeomLine.IntersectionStatus;
    912
     
    1114 * Tests of {@link AlignWaysGeomLine}
    1215 */
    13 public class AlignWaysGeomLineTest {
     16class AlignWaysGeomLineTest {
    1417    private AlignWaysGeomLine line_x1y1x2y2, line_par_x1y1x2y2;
    1518    private AlignWaysGeomLine line_abc;
     
    1821    private AlignWaysGeomLine line_horiz, line_vert;
    1922
    20     @Before
    21     public void setUp() {
     23    @BeforeEach
     24    void setUp() {
    2225        line_x1y1x2y2 = new AlignWaysGeomLine(-2.0, -1.0, 4.0, 3.0);
    2326        line_abc = new AlignWaysGeomLine(2.0/3, -1.0, 1.0/3);
     
    3033
    3134    @Test
    32     public void LineLineEquiv() {
    33         assertTrue(line_x1y1x2y2.equals(line_line));
     35    void testLineLineEquiv() {
     36        assertEquals(line_x1y1x2y2, line_line);
    3437    }
    3538
    3639    @Test
    37     public void LineAbcLineEquiv() {
    38         assertTrue(line_x1y1x2y2.equals(line_abc));
     40    void testLineAbcLineEquiv() {
     41        assertEquals(line_x1y1x2y2, line_abc);
    3942    }
    4043
    4144    @Test
    42     public void LineMbLineEquiv() {
    43         assertTrue(line_x1y1x2y2.equals(line_mb));
     45    void testLineMbLineEquiv() {
     46        assertEquals(line_x1y1x2y2, line_mb);
    4447    }
    4548
    4649    @Test
    47     public void LineAbcMbEquiv() {
    48         assertTrue(line_abc.equals(line_mb));
     50    void testLineAbcMbEquiv() {
     51        assertEquals(line_abc, line_mb);
    4952    }
    5053
    5154    @Test
    52     public void LineLineParallel() {
     55    void testLineLineParallel() {
    5356        line_x1y1x2y2.getIntersection(line_par_x1y1x2y2);
    54         assertTrue(line_x1y1x2y2.getIntersectionStatus() == IntersectionStatus.LINES_PARALLEL);
     57        assertSame(line_x1y1x2y2.getIntersectionStatus(), IntersectionStatus.LINES_PARALLEL);
    5558    }
    5659
    5760    @Test
    58     public void LineAbcOverlap() {
     61    void testLineAbcOverlap() {
    5962        line_x1y1x2y2.getIntersection(line_abc);
    60         assertTrue(line_x1y1x2y2.getIntersectionStatus() == IntersectionStatus.LINES_OVERLAP);
     63        assertSame(line_x1y1x2y2.getIntersectionStatus(), IntersectionStatus.LINES_OVERLAP);
    6164    }
    6265
    6366    @Test
    64     public void LineMbOverlap() {
     67    void testLineMbOverlap() {
    6568        line_x1y1x2y2.getIntersection(line_mb);
    66         assertTrue(line_x1y1x2y2.getIntersectionStatus() == IntersectionStatus.LINES_OVERLAP);
     69        assertSame(line_x1y1x2y2.getIntersectionStatus(), IntersectionStatus.LINES_OVERLAP);
    6770    }
    6871
    6972    @Test
    70     public void AbcMbOverlap() {
     73    void testAbcMbOverlap() {
    7174        line_abc.getIntersection(line_mb);
    72         assertTrue(line_abc.getIntersectionStatus() == IntersectionStatus.LINES_OVERLAP);
     75        assertSame(line_abc.getIntersectionStatus(), IntersectionStatus.LINES_OVERLAP);
    7376    }
    7477
    7578    @Test
    76     public void GetXOnHoriz() {
     79    void testGetXOnHoriz() {
    7780        assertTrue(line_horiz.getXonLine(2.0).isNaN());
    7881    }
    7982
    8083    @Test
    81     public void GetYOnVert() {
     84    void testGetYOnVert() {
    8285        assertTrue(line_vert.getYonLine(2.0).isNaN());
    8386    }
    8487
    8588    @Test
    86     public void StatusUndefAfterConstruct() throws Exception {
     89    void testStatusUndefAfterConstruct() {
    8790        AlignWaysGeomLine newLine = new AlignWaysGeomLine(1.0, 2.0);
    88         assertTrue(newLine.getIntersectionStatus() == IntersectionStatus.UNDEFINED);
    89 
     91        assertSame(newLine.getIntersectionStatus(), IntersectionStatus.UNDEFINED);
    9092    }
    9193
Note: See TracChangeset for help on using the changeset viewer.