TrackRecordingService: re-worked TrackPoint recording tests for state changes.

This commit is contained in:
Dennis Guse
2022-01-08 12:01:57 +01:00
parent 8b5320e40e
commit ab07d3b130
4 changed files with 201 additions and 259 deletions
@@ -93,9 +93,6 @@ public class BluetoothLeAdapter extends BaseAdapter {
return address;
}
/**
* Check if the address is identical.
*/
@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -77,6 +77,18 @@ public class TrackStatistics {
totalAltitudeLoss_m = other.totalAltitudeLoss_m;
}
@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) {
this.startTime = Instant.parse(startTime);
this.stopTime = Instant.parse(stopTime);
this.totalDistance = Distance.of(totalDistance_m);
this.totalTime = Duration.ofSeconds(totalTime_s);
this.movingTime = Duration.ofSeconds(movingTime_s);
this.maxSpeed = Speed.of(maxSpeed_mps);
this.totalAltitudeGain_m = totalAltitudeGain_m;
this.totalAltitudeLoss_m = totalAltitudeLoss_m;
}
/**
* Combines these statistics with those from another object.
* This assumes that the time periods covered by each do not intersect.
@@ -318,6 +330,14 @@ public class TrackStatistics {
totalAltitudeLoss_m += loss_m;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof TrackStatistics)) return false;
return toString().equals(o.toString());
}
@NonNull
@Override
public String toString() {