forked from upstream-mirrors/OpenTracks
TrackRecordingService: cleanup tests.
This commit is contained in:
+1
-3
@@ -40,9 +40,7 @@ import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.time.Clock;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
@@ -132,7 +130,7 @@ public class TrackRecordingServiceTestMarker {
|
||||
TrackPointCreator trackPointCreator = service.getTrackPointCreator();
|
||||
trackPointCreator.stopGPS();
|
||||
|
||||
trackPointCreator.setClock(Clock.fixed(Instant.parse("2020-02-02T02:02:02Z"), ZoneId.of("CET")));
|
||||
trackPointCreator.setClock("2020-02-02T02:02:02Z");
|
||||
Track.Id trackId = service.startNewTrack();
|
||||
service.stopUpdateRecordingData();
|
||||
|
||||
|
||||
+11
-14
@@ -23,9 +23,7 @@ import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.time.Clock;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
@@ -108,14 +106,13 @@ public class TrackRecordingServiceTestRecording {
|
||||
// given
|
||||
TrackPointCreator trackPointCreator = service.getTrackPointCreator();
|
||||
|
||||
trackPointCreator.setClock(Clock.fixed(Instant.parse("2020-02-02T02:02:02Z"), ZoneId.of("CET")));
|
||||
trackPointCreator.setClock("2020-02-02T02:02:02Z");
|
||||
Track.Id trackId = service.startNewTrack();
|
||||
service.stopUpdateRecordingData();
|
||||
trackPointCreator.stopGPS();
|
||||
trackPointCreator.setAltitudeSumManager(altitudeSumManager);
|
||||
|
||||
// when
|
||||
trackPointCreator.setClock(Clock.fixed(Instant.parse("2020-02-02T02:02:03Z"), ZoneId.of("CET")));
|
||||
trackPointCreator.setClock("2020-02-02T02:02:03Z");
|
||||
service.endCurrentTrack();
|
||||
|
||||
// then
|
||||
@@ -136,14 +133,14 @@ public class TrackRecordingServiceTestRecording {
|
||||
// given
|
||||
TrackPointCreator trackPointCreator = service.getTrackPointCreator();
|
||||
|
||||
trackPointCreator.setClock(Clock.fixed(Instant.parse("2020-02-02T02:02:02Z"), ZoneId.of("CET")));
|
||||
trackPointCreator.setClock("2020-02-02T02:02:02Z");
|
||||
Track.Id trackId = service.startNewTrack();
|
||||
service.stopUpdateRecordingData();
|
||||
trackPointCreator.stopGPS();
|
||||
trackPointCreator.setAltitudeSumManager(altitudeSumManager);
|
||||
|
||||
// when
|
||||
trackPointCreator.setClock(Clock.fixed(Instant.parse("2020-02-02T02:02:03Z"), ZoneId.of("CET")));
|
||||
trackPointCreator.setClock("2020-02-02T02:02:03Z");
|
||||
service.pauseCurrentTrack();
|
||||
service.stopUpdateRecordingData();
|
||||
|
||||
@@ -151,7 +148,7 @@ public class TrackRecordingServiceTestRecording {
|
||||
assertEquals(2, contentProviderUtils.getTrackPointCursor(trackId, null).getCount());
|
||||
|
||||
//when
|
||||
trackPointCreator.setClock(Clock.fixed(Instant.parse("2020-02-02T02:02:04Z"), ZoneId.of("CET")));
|
||||
trackPointCreator.setClock("2020-02-02T02:02:04Z");
|
||||
service.resumeTrack(trackId);
|
||||
service.stopUpdateRecordingData();
|
||||
|
||||
@@ -175,17 +172,17 @@ public class TrackRecordingServiceTestRecording {
|
||||
// given
|
||||
TrackPointCreator trackPointCreator = service.getTrackPointCreator();
|
||||
|
||||
trackPointCreator.setClock(Clock.fixed(Instant.parse("2020-02-02T02:02:02Z"), ZoneId.of("CET")));
|
||||
trackPointCreator.setClock("2020-02-02T02:02:02Z");
|
||||
Track.Id trackId = service.startNewTrack();
|
||||
service.stopUpdateRecordingData();
|
||||
trackPointCreator.stopGPS();
|
||||
trackPointCreator.setAltitudeSumManager(altitudeSumManager);
|
||||
|
||||
trackPointCreator.setClock(Clock.fixed(Instant.parse("2020-02-02T02:02:03Z"), ZoneId.of("CET")));
|
||||
trackPointCreator.setClock("2020-02-02T02:02:03Z");
|
||||
service.endCurrentTrack();
|
||||
|
||||
// when
|
||||
trackPointCreator.setClock(Clock.fixed(Instant.parse("2020-02-02T02:02:04Z"), ZoneId.of("CET")));
|
||||
trackPointCreator.setClock("2020-02-02T02:02:04Z");
|
||||
service.resumeTrack(trackId);
|
||||
trackPointCreator.stopGPS();
|
||||
trackPointCreator.setAltitudeSumManager(altitudeSumManager);
|
||||
@@ -215,17 +212,17 @@ public class TrackRecordingServiceTestRecording {
|
||||
// given
|
||||
TrackPointCreator trackPointCreator = service.getTrackPointCreator();
|
||||
|
||||
trackPointCreator.setClock(Clock.fixed(Instant.parse("2020-02-02T02:02:02Z"), ZoneId.of("CET")));
|
||||
trackPointCreator.setClock("2020-02-02T02:02:02Z");
|
||||
Track.Id trackId = service.startNewTrack();
|
||||
service.stopUpdateRecordingData();
|
||||
trackPointCreator.stopGPS();
|
||||
trackPointCreator.setAltitudeSumManager(altitudeSumManager);
|
||||
|
||||
trackPointCreator.setClock(Clock.fixed(Instant.parse("2020-02-02T02:02:03Z"), ZoneId.of("CET")));
|
||||
trackPointCreator.setClock("2020-02-02T02:02:03Z");
|
||||
service.pauseCurrentTrack();
|
||||
|
||||
// when
|
||||
trackPointCreator.setClock(Clock.fixed(Instant.parse("2020-02-02T02:02:04Z"), ZoneId.of("CET")));
|
||||
trackPointCreator.setClock("2020-02-02T02:02:04Z");
|
||||
service.endCurrentTrack();
|
||||
|
||||
// then
|
||||
|
||||
+4
-6
@@ -22,10 +22,8 @@ import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.time.Clock;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
@@ -103,7 +101,7 @@ public class TrackRecordingServiceTestStatistics {
|
||||
// given
|
||||
service.getTrackPointCreator().stopGPS();
|
||||
|
||||
service.getTrackPointCreator().setClock(Clock.fixed(Instant.ofEpochMilli(0), ZoneId.systemDefault()));
|
||||
service.getTrackPointCreator().setClock(Instant.ofEpochMilli(0).toString());
|
||||
Track.Id trackId = service.startNewTrack();
|
||||
service.stopUpdateRecordingData();
|
||||
service.getTrackPointCreator().setAltitudeSumManager(altitudeSumManager);
|
||||
@@ -157,18 +155,18 @@ public class TrackRecordingServiceTestStatistics {
|
||||
assertMovingTime.apply(movingtime_s);
|
||||
assertTotalTime.apply(19 * 60);
|
||||
|
||||
service.getTrackPointCreator().setClock(Clock.fixed(Instant.ofEpochSecond(40 * 60), ZoneId.systemDefault()));
|
||||
service.getTrackPointCreator().setClock(Instant.ofEpochSecond(40 * 60).toString());
|
||||
assertMovingTime.apply(movingtime_s);
|
||||
service.pauseCurrentTrack();
|
||||
assertTotalTime.apply(40 * 60);
|
||||
|
||||
service.getTrackPointCreator().setClock(Clock.fixed(Instant.ofEpochSecond(41 * 60), ZoneId.systemDefault()));
|
||||
service.getTrackPointCreator().setClock(Instant.ofEpochSecond(41 * 60).toString());
|
||||
service.resumeCurrentTrack();
|
||||
TrackRecordingServiceTestUtils.newTrackPoint(service, 45.0016, 35.0, 2, 15, 42 * 60000);
|
||||
assertMovingTime.apply(movingtime_s);
|
||||
assertTotalTime.apply(41 * 60);
|
||||
|
||||
service.getTrackPointCreator().setClock(Clock.fixed(Instant.ofEpochSecond(50 * 60), ZoneId.systemDefault()));
|
||||
service.getTrackPointCreator().setClock(Instant.ofEpochSecond(50 * 60).toString());
|
||||
service.endCurrentTrack();
|
||||
assertMovingTime.apply(movingtime_s);
|
||||
assertTotalTime.apply(49 * 60);
|
||||
|
||||
Reference in New Issue
Block a user