mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-07 11:53:07 +02:00
Cleanup: rename TrackStatistics to SegmentStatisticsUpdater.
This commit is contained in:
@@ -32,7 +32,7 @@ import de.dennisguse.opentracks.data.models.HeartRate;
|
||||
import de.dennisguse.opentracks.data.models.Speed;
|
||||
|
||||
/**
|
||||
* Tests for {@link TrackStatistics}.
|
||||
* Tests for {@link SegmentStatisticUpdater}.
|
||||
* This only tests non-trivial pieces of that class.
|
||||
*
|
||||
* @author Rodrigo Damazio
|
||||
@@ -40,17 +40,17 @@ import de.dennisguse.opentracks.data.models.Speed;
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class TrackStatisticsTest {
|
||||
|
||||
private TrackStatistics statistics;
|
||||
private SegmentStatisticUpdater statistics;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
statistics = new TrackStatistics();
|
||||
statistics = new SegmentStatisticUpdater();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMerge_no_data() {
|
||||
// given
|
||||
TrackStatistics statistics2 = new TrackStatistics();
|
||||
SegmentStatisticUpdater statistics2 = new SegmentStatisticUpdater();
|
||||
|
||||
// when
|
||||
statistics.merge(statistics2);
|
||||
@@ -74,7 +74,7 @@ public class TrackStatisticsTest {
|
||||
@Test
|
||||
public void testMerge() {
|
||||
// given
|
||||
TrackStatistics statistics2 = new TrackStatistics();
|
||||
SegmentStatisticUpdater statistics2 = new SegmentStatisticUpdater();
|
||||
statistics.setStartTime(Instant.ofEpochMilli(1000)); // Resulting start time
|
||||
statistics.setStopTime(Instant.ofEpochMilli(2500));
|
||||
statistics2.setStartTime(Instant.ofEpochMilli(3000));
|
||||
|
||||
@@ -31,7 +31,7 @@ public class TrackStatisticsUpdaterTest {
|
||||
TrackStatisticsUpdater subject = new TrackStatisticsUpdater();
|
||||
|
||||
// then
|
||||
TrackStatistics statistics = subject.getTrackStatistics();
|
||||
SegmentStatisticUpdater statistics = subject.getTrackStatistics();
|
||||
assertNull(statistics.getStartTime());
|
||||
assertNull(statistics.getStopTime());
|
||||
assertEquals(Duration.ZERO, statistics.getTotalTime());
|
||||
@@ -58,7 +58,7 @@ public class TrackStatisticsUpdaterTest {
|
||||
subject.addTrackPoint(tp);
|
||||
|
||||
// then
|
||||
TrackStatistics statistics = subject.getTrackStatistics();
|
||||
SegmentStatisticUpdater statistics = subject.getTrackStatistics();
|
||||
assertEquals(startTime, statistics.getStartTime());
|
||||
assertEquals(startTime, statistics.getStopTime());
|
||||
assertEquals(Duration.ZERO, statistics.getTotalTime());
|
||||
@@ -83,7 +83,7 @@ public class TrackStatisticsUpdaterTest {
|
||||
data.trackPoints().forEach(subject::addTrackPoint);
|
||||
|
||||
// then
|
||||
TrackStatistics statistics = subject.getTrackStatistics();
|
||||
SegmentStatisticUpdater statistics = subject.getTrackStatistics();
|
||||
assertEquals(142.26, statistics.getTotalDistance().toM(), 0.01);
|
||||
assertEquals(Duration.ofSeconds(12), statistics.getTotalTime());
|
||||
assertEquals(Duration.ofSeconds(12), statistics.getMovingTime());
|
||||
|
||||
Reference in New Issue
Block a user