Changeset 17845 in josm for trunk/test/unit/org


Ignore:
Timestamp:
2021-05-01T14:00:25+02:00 (3 years ago)
Author:
simon04
Message:

see #14176 - Introduce class Interval

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
1 added
2 edited

Legend:

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

    r17841 r17845  
    3333import org.openstreetmap.josm.testutils.JOSMTestRules;
    3434import org.openstreetmap.josm.tools.ListenerList;
     35import org.openstreetmap.josm.tools.date.Interval;
    3536import org.xml.sax.SAXException;
    3637
     
    330331    @Test
    331332    void testGetMinMaxTimeForAllTracks() {
    332         assertEquals(0, data.getMinMaxTimeForAllTracks().length);
     333        assertFalse(data.getMinMaxTimeForAllTracks().isPresent());
    333334
    334335        WayPoint p1 = new WayPoint(LatLon.NORTH_POLE);
     
    343344        data.addTrack(new GpxTrack(Arrays.asList(Arrays.asList(p3, p4, p5)), Collections.emptyMap()));
    344345
    345         Instant[] times = data.getMinMaxTimeForAllTracks();
    346         assertEquals(times.length, 2);
    347         assertEquals(Instant.ofEpochMilli(100020), times[0]);
    348         assertEquals(Instant.ofEpochMilli(500020), times[1]);
     346        Interval times = data.getMinMaxTimeForAllTracks().orElse(null);
     347        assertEquals("1970-01-01T00:01:40.020Z/1970-01-01T00:08:20.020Z", times.toString());
     348        assertEquals(Instant.ofEpochMilli(100020), times.getStart());
     349        assertEquals(Instant.ofEpochMilli(500020), times.getEnd());
    349350    }
    350351
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/GpxLayerTest.java

    r17844 r17845  
    1010import java.awt.Color;
    1111import java.io.IOException;
    12 import java.time.Instant;
    1312import java.util.ArrayList;
    1413import java.util.Collection;
     
    217216
    218217    /**
    219      * Unit test of {@link GpxLayer#formatTimespan}.
    220      */
    221     @Test
    222     void testFormatTimespan() {
    223         Instant[] timespan = {Instant.parse("2021-03-01T17:53:16Z"), Instant.parse("2021-04-03T08:19:19Z")};
    224         assertEquals("2021-03-01 17:53:16 \u2013 2021-04-03 08:19:19 (32 days 14 h)", GpxLayer.formatTimespan(timespan));
    225     }
    226 
    227     /**
    228218     * Unit test of {@link GpxLayer#mergeFrom}.
    229219     * @throws Exception if any error occurs
Note: See TracChangeset for help on using the changeset viewer.