Ignore:
Timestamp:
2023-10-16T15:19:07+02:00 (11 months ago)
Author:
taylor.smock
Message:

See #16567: Update to JUnit 5

This converts most tests to use @Annotations. There are also some performance
improvements as it relates to tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxDataTest.java

    r18494 r18870  
    2121import org.junit.jupiter.api.BeforeEach;
    2222import org.junit.jupiter.api.Test;
    23 import org.junit.jupiter.api.extension.RegisterExtension;
    2423import org.openstreetmap.josm.TestUtils;
    2524import org.openstreetmap.josm.data.Bounds;
     
    3231import org.openstreetmap.josm.data.projection.ProjectionRegistry;
    3332import org.openstreetmap.josm.io.GpxReaderTest;
    34 import org.openstreetmap.josm.testutils.JOSMTestRules;
     33import org.openstreetmap.josm.testutils.annotations.Projection;
    3534import org.openstreetmap.josm.tools.ListenerList;
    3635import org.openstreetmap.josm.tools.date.Interval;
    3736import org.xml.sax.SAXException;
    3837
    39 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    4038import nl.jqno.equalsverifier.EqualsVerifier;
    4139import nl.jqno.equalsverifier.Warning;
     
    4442 * Unit tests for class {@link GpxData}.
    4543 */
     44@Projection
    4645class GpxDataTest {
    47 
    48     /**
    49      * Setup test.
    50      */
    51     @RegisterExtension
    52     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    53     public JOSMTestRules test = new JOSMTestRules().projection();
    54 
    5546    private GpxData data;
    5647
     
    339330        p2.setInstant(Instant.ofEpochMilli(200020));
    340331
    341         data.addTrack(new GpxTrack(Arrays.asList(Arrays.asList(p2)), Collections.emptyMap()));
    342         data.addTrack(new GpxTrack(Arrays.asList(Arrays.asList(p1)), Collections.emptyMap()));
     332        data.addTrack(new GpxTrack(Collections.singletonList(Collections.singletonList(p2)), Collections.emptyMap()));
     333        data.addTrack(new GpxTrack(Collections.singletonList(Collections.singletonList(p1)), Collections.emptyMap()));
    343334
    344335        List<IGpxTrack> tracks = data.getOrderedTracks();
     
    364355        p2.setInstant(Instant.ofEpochMilli(100020));
    365356        p4.setInstant(Instant.ofEpochMilli(500020));
    366         data.addTrack(new GpxTrack(Arrays.asList(Arrays.asList(p1, p2)), Collections.emptyMap()));
    367         data.addTrack(new GpxTrack(Arrays.asList(Arrays.asList(p3, p4, p5)), Collections.emptyMap()));
     357        data.addTrack(new GpxTrack(Collections.singletonList(Arrays.asList(p1, p2)), Collections.emptyMap()));
     358        data.addTrack(new GpxTrack(Collections.singletonList(Arrays.asList(p3, p4, p5)), Collections.emptyMap()));
    368359
    369360        Interval times = data.getMinMaxTimeForAllTracks().orElse(null);
     
    383374                .map(WayPoint::new)
    384375                .collect(Collectors.toList());
    385         data.addTrack(new GpxTrack(Arrays.asList(points), Collections.emptyMap()));
     376        data.addTrack(new GpxTrack(Collections.singletonList(points), Collections.emptyMap()));
    386377
    387378        WayPoint closeToMiddle = data.nearestPointOnTrack(new EastNorth(10, 0), 10);
     
    406397        DataSource ds = new DataSource(new Bounds(0, 0, 1, 1), "test");
    407398        data.dataSources.add(ds);
    408         assertEquals(new ArrayList<>(Arrays.asList(ds)), new ArrayList<>(data.getDataSources()));
     399        assertEquals(new ArrayList<>(Collections.singletonList(ds)), new ArrayList<>(data.getDataSources()));
    409400    }
    410401
     
    429420        DataSource ds = new DataSource(bounds, "test");
    430421        data.dataSources.add(ds);
    431         assertEquals(Arrays.asList(bounds), data.getDataSourceBounds());
     422        assertEquals(Collections.singletonList(bounds), data.getDataSourceBounds());
    432423    }
    433424
Note: See TracChangeset for help on using the changeset viewer.