forked from upstream-mirrors/OpenTracks
Cleanup.
This commit is contained in:
-44
@@ -728,50 +728,6 @@ public class CustomContentProviderUtilsTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests the method {@link ContentProviderUtils#createTrackPoint(Cursor)}.
|
|
||||||
*/
|
|
||||||
//TODO incomplete
|
|
||||||
@Test
|
|
||||||
public void testCreateTrackPoint() {
|
|
||||||
// given
|
|
||||||
when(cursorMock.getColumnIndex(TrackPointsColumns._ID)).thenReturn(1);
|
|
||||||
|
|
||||||
when(cursorMock.getColumnIndexOrThrow(TrackPointsColumns.LONGITUDE)).thenReturn(2);
|
|
||||||
when(cursorMock.isNull(2)).thenReturn(false);
|
|
||||||
int longitude = 11;
|
|
||||||
when(cursorMock.getInt(2)).thenReturn(longitude * 1000000);
|
|
||||||
|
|
||||||
when(cursorMock.getColumnIndexOrThrow(TrackPointsColumns.LATITUDE)).thenReturn(3);
|
|
||||||
when(cursorMock.isNull(3)).thenReturn(false);
|
|
||||||
int latitude = 22;
|
|
||||||
when(cursorMock.getInt(3)).thenReturn(latitude * 1000000);
|
|
||||||
|
|
||||||
when(cursorMock.getColumnIndexOrThrow(TrackPointsColumns.TIME)).thenReturn(4);
|
|
||||||
when(cursorMock.isNull(4)).thenReturn(false);
|
|
||||||
long time = System.currentTimeMillis();
|
|
||||||
when(cursorMock.getLong(4)).thenReturn(time);
|
|
||||||
|
|
||||||
when(cursorMock.getColumnIndexOrThrow(TrackPointsColumns.SPEED)).thenReturn(5);
|
|
||||||
when(cursorMock.isNull(5)).thenReturn(false);
|
|
||||||
float speed = 2.2f;
|
|
||||||
when(cursorMock.getFloat(5)).thenReturn(speed);
|
|
||||||
|
|
||||||
when(cursorMock.getColumnIndexOrThrow(TrackPointsColumns.SENSOR_HEARTRATE)).thenReturn(6);
|
|
||||||
when(cursorMock.isNull(6)).thenReturn(false);
|
|
||||||
when(cursorMock.getFloat(6)).thenReturn(75f);
|
|
||||||
|
|
||||||
// when
|
|
||||||
TrackPoint trackPoint = contentProviderUtils.createTrackPoint(cursorMock);
|
|
||||||
|
|
||||||
// then
|
|
||||||
assertEquals(latitude, trackPoint.getPosition().latitude(), 0.01);
|
|
||||||
assertEquals(longitude, trackPoint.getPosition().longitude(), 0.01);
|
|
||||||
assertEquals(time, trackPoint.getTime().toEpochMilli());
|
|
||||||
assertEquals(speed, trackPoint.getSpeed().toMPS(), 0.01);
|
|
||||||
assertEquals(HeartRate.of(75f), trackPoint.getHeartRate());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the method
|
* Tests the method
|
||||||
* {@link ContentProviderUtils#insertTrackPoint(TrackPoint, Track.Id)}.
|
* {@link ContentProviderUtils#insertTrackPoint(TrackPoint, Track.Id)}.
|
||||||
|
|||||||
@@ -622,16 +622,6 @@ public class ContentProviderUtils {
|
|||||||
return contentResolver.bulkInsert(MarkerColumns.CONTENT_URI, values);
|
return contentResolver.bulkInsert(MarkerColumns.CONTENT_URI, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a {@link TrackPoint} object from a cursor.
|
|
||||||
*
|
|
||||||
* @param cursor the cursor pointing to the location
|
|
||||||
*/
|
|
||||||
@VisibleForTesting
|
|
||||||
TrackPoint createTrackPoint(Cursor cursor) {
|
|
||||||
return fillTrackPoint(cursor, new CachedTrackPointsIndexes(cursor));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a location cursor. The caller owns the returned cursor and is responsible for closing it.
|
* Creates a location cursor. The caller owns the returned cursor and is responsible for closing it.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user