TrackRecordingService: add integration tests.

This commit is contained in:
Dennis Guse
2022-01-09 13:40:07 +01:00
parent ab07d3b130
commit cd7bf36aa9
7 changed files with 475 additions and 445 deletions
@@ -415,27 +415,25 @@ public class TrackPoint {
return this;
}
@NonNull
@Override
public String toString() {
String result = "time=" + getTime() + " (type=" + getType() + ")";
if (hasLocation()) {
result += ": lat=" + getLatitude() + " lng=" + getLongitude() + " alt=" + getAltitude();
}
if (hasHorizontalAccuracy()) {
result += " acc=" + getHorizontalAccuracy();
}
if (hasSensorDistance()) {
result += " distance=" + getSensorDistance();
}
if (hasAltitudeGain()) {
result += " altitudeGain= " + getAltitudeGain();
}
if (hasAltitudeLoss()) {
result += " altitudeLoss= " + getAltitudeLoss();
}
return result;
return "TrackPoint{" +
"id=" + id +
", time=" + time +
", latitude=" + latitude +
", longitude=" + longitude +
", horizontalAccuracy=" + horizontalAccuracy +
", altitude=" + altitude +
", speed=" + speed +
", bearing=" + bearing +
", sensorDistance=" + sensorDistance +
", type=" + type +
", heartRate_bpm=" + heartRate_bpm +
", cadence_rpm=" + cadence_rpm +
", power=" + power +
", altitudeGain_m=" + altitudeGain_m +
", altitudeLoss_m=" + altitudeLoss_m +
'}';
}
public static class Id {
@@ -178,6 +178,12 @@ public class TrackPointCreator implements BluetoothRemoteSensorManager.SensorDat
this.altitudeSumManager = altitudeSumManager;
}
@Deprecated
@VisibleForTesting
public BluetoothRemoteSensorManager getRemoteSensorManager() {
return remoteSensorManager;
}
@Deprecated
@VisibleForTesting
public void setRemoteSensorManager(BluetoothRemoteSensorManager remoteSensorManager) {
@@ -168,6 +168,11 @@ public class PreferencesUtils {
editor.apply();
}
@VisibleForTesting
public static void setString(int keyId, int valueId) {
setString(keyId, resources.getString(valueId));
}
static void setInt(int keyId, int value) {
Editor editor = sharedPreferences.edit();
editor.putInt(getKey(keyId), value);
@@ -78,7 +78,7 @@ public class TrackStatistics {
}
@VisibleForTesting
public TrackStatistics(String startTime, String stopTime, int totalDistance_m, int totalTime_s, int movingTime_s, float maxSpeed_mps, Float totalAltitudeGain_m, Float totalAltitudeLoss_m) {
public TrackStatistics(String startTime, String stopTime, double totalDistance_m, int totalTime_s, int movingTime_s, float maxSpeed_mps, Float totalAltitudeGain_m, Float totalAltitudeLoss_m) {
this.startTime = Instant.parse(startTime);
this.stopTime = Instant.parse(stopTime);
this.totalDistance = Distance.of(totalDistance_m);