Tests: create TrackPoint instead of Location.

This commit is contained in:
Dennis Guse
2021-06-30 22:33:40 +02:00
parent 3cb04a1ca0
commit 5899235b2b
6 changed files with 39 additions and 51 deletions
@@ -1,7 +1,5 @@
package de.dennisguse.opentracks.content.data;
import android.location.Location;
import org.junit.Test;
import java.time.Instant;
@@ -31,15 +29,13 @@ public class TrackPointTest {
@Test
public void distanceToPrevious() {
Location l1 = new Location("test");
l1.setLatitude(0);
l1.setLongitude(0.0001);
TrackPoint tp1 = new TrackPoint(l1);
TrackPoint tp1 = new TrackPoint(TrackPoint.Type.TRACKPOINT)
.setLatitude(0)
.setLongitude(0.0001);
Location l2 = new Location("test");
l2.setLatitude(0);
l2.setLongitude(0.0002);
TrackPoint tp2 = new TrackPoint(l2);
TrackPoint tp2 = new TrackPoint(TrackPoint.Type.TRACKPOINT)
.setLatitude(0)
.setLongitude(0.0002);
// without sensor distance
assertEquals(11.13, tp2.distanceToPrevious(tp1).toM(), 0.01);
@@ -135,12 +135,12 @@ public class CustomContentProviderUtilsTest {
List<TrackPoint> trackPoints = new ArrayList<>(numPoints);
for (int i = 0; i < numPoints; ++i) {
Location loc = new Location("test");
loc.setLatitude(37.0 + (double) i / 10000.0);
loc.setLongitude(57.0 - (double) i / 10000.0);
loc.setAccuracy((float) i / 100.0f);
loc.setAltitude(i * 2.5);
trackPoints.add(new TrackPoint(loc));
TrackPoint trackPoint = new TrackPoint(TrackPoint.Type.TRACKPOINT)
.setLatitude(37.0 + (double) i / 10000.0)
.setLongitude(57.0 - (double) i / 10000.0)
.setAccuracy((float) i / 100.0f)
.setAltitude(i * 2.5);
trackPoints.add(trackPoint);
}
contentProviderUtils.bulkInsertTrackPoint(trackPoints, id);
@@ -1252,7 +1252,7 @@ public class CustomContentProviderUtilsTest {
@Test
public void testGetSensorStats_veryLongActivity12h() {
testGetSensorStats_randomData(43200 / 6, false);
testGetSensorStats_randomData(43200 / 6, false);
}
@Test