forked from upstream-mirrors/OpenTracks
Cleanup: use correct order for assert in tests.
This commit is contained in:
+2
-2
@@ -450,7 +450,7 @@ public class CustomContentProviderUtilsTest {
|
|||||||
contentProviderUtils.insertMarker(marker1);
|
contentProviderUtils.insertMarker(marker1);
|
||||||
|
|
||||||
// Check insert was done.
|
// Check insert was done.
|
||||||
assertEquals(contentProviderUtils.getMarkers(trackId).size(), 1);
|
assertEquals(1, contentProviderUtils.getMarkers(trackId).size());
|
||||||
|
|
||||||
// Get marker id that needs to delete.
|
// Get marker id that needs to delete.
|
||||||
Marker.Id marker1Id = contentProviderUtils.insertMarker(marker1);
|
Marker.Id marker1Id = contentProviderUtils.insertMarker(marker1);
|
||||||
@@ -477,7 +477,7 @@ public class CustomContentProviderUtilsTest {
|
|||||||
contentProviderUtils.insertMarker(marker1);
|
contentProviderUtils.insertMarker(marker1);
|
||||||
|
|
||||||
// Check insert was done.
|
// Check insert was done.
|
||||||
assertEquals(contentProviderUtils.getMarkers(trackId).size(), 1);
|
assertEquals(1, contentProviderUtils.getMarkers(trackId).size());
|
||||||
|
|
||||||
// Get marker id that needs to delete.
|
// Get marker id that needs to delete.
|
||||||
Marker.Id marker1Id = contentProviderUtils.insertMarker(marker1);
|
Marker.Id marker1Id = contentProviderUtils.insertMarker(marker1);
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ public class TrackSelectionTest extends TestCase {
|
|||||||
SelectionData selection = filter.buildSelection();
|
SelectionData selection = filter.buildSelection();
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
assertEquals(selection.selection(), "_id IN (?)");
|
assertEquals("_id IN (?)", selection.selection());
|
||||||
assertEquals(selection.selectionArgs().length, 1);
|
assertEquals(1, selection.selectionArgs().length);
|
||||||
assertEquals(selection.selectionArgs()[0], "1");
|
assertEquals("1", selection.selectionArgs()[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -57,11 +57,11 @@ public class TrackSelectionTest extends TestCase {
|
|||||||
SelectionData selection = filter.buildSelection();
|
SelectionData selection = filter.buildSelection();
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
assertEquals(selection.selection(), "_id IN (?,?,?)");
|
assertEquals("_id IN (?,?,?)", selection.selection());
|
||||||
assertEquals(selection.selectionArgs().length, 3);
|
assertEquals(3, selection.selectionArgs().length);
|
||||||
assertEquals(selection.selectionArgs()[0], "1");
|
assertEquals("1", selection.selectionArgs()[0]);
|
||||||
assertEquals(selection.selectionArgs()[1], "2");
|
assertEquals("2", selection.selectionArgs()[1]);
|
||||||
assertEquals(selection.selectionArgs()[2], "3");
|
assertEquals("3", selection.selectionArgs()[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -73,9 +73,9 @@ public class TrackSelectionTest extends TestCase {
|
|||||||
SelectionData selection = filter.buildSelection();
|
SelectionData selection = filter.buildSelection();
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
assertEquals(selection.selection(), "category IN (?)");
|
assertEquals("category IN (?)", selection.selection());
|
||||||
assertEquals(selection.selectionArgs().length, 1);
|
assertEquals(1, selection.selectionArgs().length);
|
||||||
assertEquals(selection.selectionArgs()[0], "running");
|
assertEquals("running", selection.selectionArgs()[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -91,12 +91,12 @@ public class TrackSelectionTest extends TestCase {
|
|||||||
SelectionData selection = filter.buildSelection();
|
SelectionData selection = filter.buildSelection();
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
assertEquals(selection.selection(), "category IN (?,?,?,?)");
|
assertEquals("category IN (?,?,?,?)", selection.selection());
|
||||||
assertEquals(selection.selectionArgs().length, 4);
|
assertEquals(4, selection.selectionArgs().length);
|
||||||
assertEquals(selection.selectionArgs()[0], "running");
|
assertEquals("running", selection.selectionArgs()[0]);
|
||||||
assertEquals(selection.selectionArgs()[1], "road biking");
|
assertEquals("road biking", selection.selectionArgs()[1]);
|
||||||
assertEquals(selection.selectionArgs()[2], "mountain biking");
|
assertEquals("mountain biking", selection.selectionArgs()[2]);
|
||||||
assertEquals(selection.selectionArgs()[3], "trail walking");
|
assertEquals("trail walking", selection.selectionArgs()[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -120,8 +120,8 @@ public class TrackSelectionTest extends TestCase {
|
|||||||
assertNull(selectionWrong2.selection());
|
assertNull(selectionWrong2.selection());
|
||||||
assertNull(selectionWrong2.selectionArgs());
|
assertNull(selectionWrong2.selectionArgs());
|
||||||
|
|
||||||
assertEquals(selectionOk.selection(), "starttime BETWEEN ? AND ?");
|
assertEquals("starttime BETWEEN ? AND ?", selectionOk.selection());
|
||||||
assertEquals(selectionOk.selectionArgs().length, 2);
|
assertEquals(2, selectionOk.selectionArgs().length);
|
||||||
assertEquals(selectionOk.selectionArgs()[0], Long.toString(instant.toEpochMilli()));
|
assertEquals(selectionOk.selectionArgs()[0], Long.toString(instant.toEpochMilli()));
|
||||||
assertEquals(selectionOk.selectionArgs()[1], Long.toString(instant.toEpochMilli() + oneDay));
|
assertEquals(selectionOk.selectionArgs()[1], Long.toString(instant.toEpochMilli() + oneDay));
|
||||||
}
|
}
|
||||||
@@ -143,13 +143,13 @@ public class TrackSelectionTest extends TestCase {
|
|||||||
SelectionData selection = filter.buildSelection();
|
SelectionData selection = filter.buildSelection();
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
assertEquals(selection.selection(), "_id IN (?,?,?) AND category IN (?,?)");
|
assertEquals("_id IN (?,?,?) AND category IN (?,?)", selection.selection());
|
||||||
assertEquals(selection.selectionArgs().length, 5);
|
assertEquals(5, selection.selectionArgs().length);
|
||||||
assertEquals(selection.selectionArgs()[0], "1");
|
assertEquals("1", selection.selectionArgs()[0]);
|
||||||
assertEquals(selection.selectionArgs()[1], "2");
|
assertEquals("2", selection.selectionArgs()[1]);
|
||||||
assertEquals(selection.selectionArgs()[2], "3");
|
assertEquals("3", selection.selectionArgs()[2]);
|
||||||
assertEquals(selection.selectionArgs()[3], "running");
|
assertEquals("running", selection.selectionArgs()[3]);
|
||||||
assertEquals(selection.selectionArgs()[4], "road biking");
|
assertEquals("road biking", selection.selectionArgs()[4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -172,11 +172,11 @@ public class TrackSelectionTest extends TestCase {
|
|||||||
SelectionData selection = filter.buildSelection();
|
SelectionData selection = filter.buildSelection();
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
assertEquals(selection.selection(), "_id IN (?,?,?) AND starttime BETWEEN ? AND ?");
|
assertEquals("_id IN (?,?,?) AND starttime BETWEEN ? AND ?", selection.selection());
|
||||||
assertEquals(selection.selectionArgs().length, 5);
|
assertEquals(5, selection.selectionArgs().length);
|
||||||
assertEquals(selection.selectionArgs()[0], "1");
|
assertEquals("1", selection.selectionArgs()[0]);
|
||||||
assertEquals(selection.selectionArgs()[1], "2");
|
assertEquals("2", selection.selectionArgs()[1]);
|
||||||
assertEquals(selection.selectionArgs()[2], "3");
|
assertEquals("3", selection.selectionArgs()[2]);
|
||||||
assertEquals(selection.selectionArgs()[3], Long.toString(instant.toEpochMilli()));
|
assertEquals(selection.selectionArgs()[3], Long.toString(instant.toEpochMilli()));
|
||||||
assertEquals(selection.selectionArgs()[4], Long.toString(instant.toEpochMilli() + oneDay));
|
assertEquals(selection.selectionArgs()[4], Long.toString(instant.toEpochMilli() + oneDay));
|
||||||
}
|
}
|
||||||
@@ -196,10 +196,10 @@ public class TrackSelectionTest extends TestCase {
|
|||||||
SelectionData selection = filter.buildSelection();
|
SelectionData selection = filter.buildSelection();
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
assertEquals(selection.selection(), "category IN (?,?) AND starttime BETWEEN ? AND ?");
|
assertEquals("category IN (?,?) AND starttime BETWEEN ? AND ?", selection.selection());
|
||||||
assertEquals(selection.selectionArgs().length, 4);
|
assertEquals(4, selection.selectionArgs().length);
|
||||||
assertEquals(selection.selectionArgs()[0], "running");
|
assertEquals("running", selection.selectionArgs()[0]);
|
||||||
assertEquals(selection.selectionArgs()[1], "road biking");
|
assertEquals("road biking", selection.selectionArgs()[1]);
|
||||||
assertEquals(selection.selectionArgs()[2], Long.toString(instant.toEpochMilli()));
|
assertEquals(selection.selectionArgs()[2], Long.toString(instant.toEpochMilli()));
|
||||||
assertEquals(selection.selectionArgs()[3], Long.toString(instant.toEpochMilli() + oneDay));
|
assertEquals(selection.selectionArgs()[3], Long.toString(instant.toEpochMilli() + oneDay));
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -165,7 +165,7 @@ public class VoiceAnnouncementUtilsTest {
|
|||||||
TrackStatistics stats = trackWithStats.second;
|
TrackStatistics stats = trackWithStats.second;
|
||||||
IntervalStatistics.Interval lastInterval;
|
IntervalStatistics.Interval lastInterval;
|
||||||
try (TrackPointIterator trackPointIterator = contentProviderUtils.getTrackPointLocationIterator(trackId, null)) {
|
try (TrackPointIterator trackPointIterator = contentProviderUtils.getTrackPointLocationIterator(trackId, null)) {
|
||||||
assertEquals(trackPointIterator.getCount(), numberOfPoints);
|
assertEquals(numberOfPoints, trackPointIterator.getCount());
|
||||||
IntervalStatistics intervalStatistics = new IntervalStatistics(Distance.of(1000));
|
IntervalStatistics intervalStatistics = new IntervalStatistics(Distance.of(1000));
|
||||||
intervalStatistics.addTrackPoints(trackPointIterator);
|
intervalStatistics.addTrackPoints(trackPointIterator);
|
||||||
lastInterval = intervalStatistics.getIntervalList().get(intervalStatistics.getIntervalList().size() - 1);
|
lastInterval = intervalStatistics.getIntervalList().get(intervalStatistics.getIntervalList().size() - 1);
|
||||||
@@ -216,7 +216,7 @@ public class VoiceAnnouncementUtilsTest {
|
|||||||
TrackStatistics stats = trackWithStats.second;
|
TrackStatistics stats = trackWithStats.second;
|
||||||
IntervalStatistics.Interval lastInterval;
|
IntervalStatistics.Interval lastInterval;
|
||||||
try (TrackPointIterator trackPointIterator = contentProviderUtils.getTrackPointLocationIterator(trackId, null)) {
|
try (TrackPointIterator trackPointIterator = contentProviderUtils.getTrackPointLocationIterator(trackId, null)) {
|
||||||
assertEquals(trackPointIterator.getCount(), numberOfPoints);
|
assertEquals(numberOfPoints, trackPointIterator.getCount());
|
||||||
IntervalStatistics intervalStatistics = new IntervalStatistics(Distance.of(1000));
|
IntervalStatistics intervalStatistics = new IntervalStatistics(Distance.of(1000));
|
||||||
intervalStatistics.addTrackPoints(trackPointIterator);
|
intervalStatistics.addTrackPoints(trackPointIterator);
|
||||||
lastInterval = intervalStatistics.getIntervalList().get(intervalStatistics.getIntervalList().size() - 1);
|
lastInterval = intervalStatistics.getIntervalList().get(intervalStatistics.getIntervalList().size() - 1);
|
||||||
@@ -330,7 +330,7 @@ public class VoiceAnnouncementUtilsTest {
|
|||||||
TrackStatistics stats = trackWithStats.second;
|
TrackStatistics stats = trackWithStats.second;
|
||||||
IntervalStatistics.Interval lastInterval;
|
IntervalStatistics.Interval lastInterval;
|
||||||
try (TrackPointIterator trackPointIterator = contentProviderUtils.getTrackPointLocationIterator(trackId, null)) {
|
try (TrackPointIterator trackPointIterator = contentProviderUtils.getTrackPointLocationIterator(trackId, null)) {
|
||||||
assertEquals(trackPointIterator.getCount(), numberOfPoints);
|
assertEquals(numberOfPoints, trackPointIterator.getCount());
|
||||||
IntervalStatistics intervalStatistics = new IntervalStatistics(Distance.of(1000));
|
IntervalStatistics intervalStatistics = new IntervalStatistics(Distance.of(1000));
|
||||||
intervalStatistics.addTrackPoints(trackPointIterator);
|
intervalStatistics.addTrackPoints(trackPointIterator);
|
||||||
lastInterval = intervalStatistics.getIntervalList().get(intervalStatistics.getIntervalList().size() - 1);
|
lastInterval = intervalStatistics.getIntervalList().get(intervalStatistics.getIntervalList().size() - 1);
|
||||||
@@ -381,7 +381,7 @@ public class VoiceAnnouncementUtilsTest {
|
|||||||
TrackStatistics stats = trackWithStats.second;
|
TrackStatistics stats = trackWithStats.second;
|
||||||
IntervalStatistics.Interval lastInterval;
|
IntervalStatistics.Interval lastInterval;
|
||||||
try (TrackPointIterator trackPointIterator = contentProviderUtils.getTrackPointLocationIterator(trackId, null)) {
|
try (TrackPointIterator trackPointIterator = contentProviderUtils.getTrackPointLocationIterator(trackId, null)) {
|
||||||
assertEquals(trackPointIterator.getCount(), numberOfPoints);
|
assertEquals(numberOfPoints, trackPointIterator.getCount());
|
||||||
IntervalStatistics intervalStatistics = new IntervalStatistics(Distance.of(1000));
|
IntervalStatistics intervalStatistics = new IntervalStatistics(Distance.of(1000));
|
||||||
intervalStatistics.addTrackPoints(trackPointIterator);
|
intervalStatistics.addTrackPoints(trackPointIterator);
|
||||||
lastInterval = intervalStatistics.getIntervalList().get(intervalStatistics.getIntervalList().size() - 1);
|
lastInterval = intervalStatistics.getIntervalList().get(intervalStatistics.getIntervalList().size() - 1);
|
||||||
@@ -411,7 +411,7 @@ public class VoiceAnnouncementUtilsTest {
|
|||||||
TrackStatistics stats = trackWithStats.second;
|
TrackStatistics stats = trackWithStats.second;
|
||||||
IntervalStatistics.Interval lastInterval;
|
IntervalStatistics.Interval lastInterval;
|
||||||
try (TrackPointIterator trackPointIterator = contentProviderUtils.getTrackPointLocationIterator(trackId, null)) {
|
try (TrackPointIterator trackPointIterator = contentProviderUtils.getTrackPointLocationIterator(trackId, null)) {
|
||||||
assertEquals(trackPointIterator.getCount(), numberOfPoints);
|
assertEquals(numberOfPoints, trackPointIterator.getCount());
|
||||||
IntervalStatistics intervalStatistics = new IntervalStatistics(Distance.of(1000));
|
IntervalStatistics intervalStatistics = new IntervalStatistics(Distance.of(1000));
|
||||||
intervalStatistics.addTrackPoints(trackPointIterator);
|
intervalStatistics.addTrackPoints(trackPointIterator);
|
||||||
lastInterval = intervalStatistics.getIntervalList().get(intervalStatistics.getIntervalList().size() - 1);
|
lastInterval = intervalStatistics.getIntervalList().get(intervalStatistics.getIntervalList().size() - 1);
|
||||||
@@ -449,7 +449,7 @@ public class VoiceAnnouncementUtilsTest {
|
|||||||
TrackStatistics stats = trackWithStats.second;
|
TrackStatistics stats = trackWithStats.second;
|
||||||
IntervalStatistics.Interval lastInterval;
|
IntervalStatistics.Interval lastInterval;
|
||||||
try (TrackPointIterator trackPointIterator = contentProviderUtils.getTrackPointLocationIterator(trackId, null)) {
|
try (TrackPointIterator trackPointIterator = contentProviderUtils.getTrackPointLocationIterator(trackId, null)) {
|
||||||
assertEquals(trackPointIterator.getCount(), numberOfPoints);
|
assertEquals(numberOfPoints, trackPointIterator.getCount());
|
||||||
IntervalStatistics intervalStatistics = new IntervalStatistics(Distance.of(1000));
|
IntervalStatistics intervalStatistics = new IntervalStatistics(Distance.of(1000));
|
||||||
intervalStatistics.addTrackPoints(trackPointIterator);
|
intervalStatistics.addTrackPoints(trackPointIterator);
|
||||||
lastInterval = intervalStatistics.getIntervalList().get(intervalStatistics.getIntervalList().size() - 1);
|
lastInterval = intervalStatistics.getIntervalList().get(intervalStatistics.getIntervalList().size() - 1);
|
||||||
|
|||||||
+5
-5
@@ -41,7 +41,7 @@ public class PreferencesOpenHelperTest {
|
|||||||
// then there should be one layout with old custom layout that has the new CSV value.
|
// then there should be one layout with old custom layout that has the new CSV value.
|
||||||
List<RecordingLayout> recordingLayouts = PreferencesUtils.getAllCustomLayouts();
|
List<RecordingLayout> recordingLayouts = PreferencesUtils.getAllCustomLayouts();
|
||||||
assertNotNull(recordingLayouts);
|
assertNotNull(recordingLayouts);
|
||||||
assertEquals(recordingLayouts.size(), 1);
|
assertEquals(1, recordingLayouts.size());
|
||||||
assertEquals(recordingLayouts.get(0).toCsv(), PreferencesUtils.getCustomLayout().toCsv());
|
assertEquals(recordingLayouts.get(0).toCsv(), PreferencesUtils.getCustomLayout().toCsv());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ public class PreferencesOpenHelperTest {
|
|||||||
// then there should be one layout with old custom layout that has the new CSV value.
|
// then there should be one layout with old custom layout that has the new CSV value.
|
||||||
List<RecordingLayout> recordingLayouts = PreferencesUtils.getAllCustomLayouts();
|
List<RecordingLayout> recordingLayouts = PreferencesUtils.getAllCustomLayouts();
|
||||||
assertNotNull(recordingLayouts);
|
assertNotNull(recordingLayouts);
|
||||||
assertEquals(recordingLayouts.size(), 1);
|
assertEquals(1, recordingLayouts.size());
|
||||||
assertEquals(recordingLayouts.get(0).toCsv(), updatedOldCustomLayoutCsv);
|
assertEquals(recordingLayouts.get(0).toCsv(), updatedOldCustomLayoutCsv);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,8 +90,8 @@ public class PreferencesOpenHelperTest {
|
|||||||
// then there should be one layout with old custom layout that has the new CSV value.
|
// then there should be one layout with old custom layout that has the new CSV value.
|
||||||
List<RecordingLayout> recordingLayouts = PreferencesUtils.getAllCustomLayouts();
|
List<RecordingLayout> recordingLayouts = PreferencesUtils.getAllCustomLayouts();
|
||||||
assertNotNull(recordingLayouts);
|
assertNotNull(recordingLayouts);
|
||||||
assertEquals(recordingLayouts.size(), 1);
|
assertEquals(1, recordingLayouts.size());
|
||||||
assertEquals(recordingLayouts.get(0).toCsv(), updatedOldCustomLayoutCsv);
|
assertEquals(updatedOldCustomLayoutCsv, recordingLayouts.get(0).toCsv());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -113,7 +113,7 @@ public class PreferencesOpenHelperTest {
|
|||||||
RecordingLayout defaultRecordingLayout = RecordingLayoutIO.fromCsv(PreferencesUtils.buildDefaultLayout(), resources);
|
RecordingLayout defaultRecordingLayout = RecordingLayoutIO.fromCsv(PreferencesUtils.buildDefaultLayout(), resources);
|
||||||
List<RecordingLayout> customRecordingLayout = PreferencesUtils.getAllCustomLayouts();
|
List<RecordingLayout> customRecordingLayout = PreferencesUtils.getAllCustomLayouts();
|
||||||
|
|
||||||
assertEquals(customRecordingLayout.size(), 1);
|
assertEquals(1, customRecordingLayout.size());
|
||||||
assertEquals(defaultRecordingLayout.toCsv(), customRecordingLayout.get(0).toCsv());
|
assertEquals(defaultRecordingLayout.toCsv(), customRecordingLayout.get(0).toCsv());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public class PreferencesUtilsTest {
|
|||||||
List<RecordingLayout> recordingLayouts = PreferencesUtils.getAllCustomLayouts();
|
List<RecordingLayout> recordingLayouts = PreferencesUtils.getAllCustomLayouts();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
assertEquals(recordingLayouts.size(), 1);
|
assertEquals(1, recordingLayouts.size());
|
||||||
assertTrue(recordingLayouts.get(0).getFields().size() > 0);
|
assertTrue(recordingLayouts.get(0).getFields().size() > 0);
|
||||||
assertEquals(recordingLayouts.get(0).getName(), context.getString(R.string.stats_custom_layout_default_layout));
|
assertEquals(recordingLayouts.get(0).getName(), context.getString(R.string.stats_custom_layout_default_layout));
|
||||||
assertTrue(recordingLayouts.get(0).getFields().stream().anyMatch(DataField::isVisible));
|
assertTrue(recordingLayouts.get(0).getFields().stream().anyMatch(DataField::isVisible));
|
||||||
@@ -130,9 +130,9 @@ public class PreferencesUtilsTest {
|
|||||||
RecordingLayout recordingLayout = PreferencesUtils.getCustomLayout();
|
RecordingLayout recordingLayout = PreferencesUtils.getCustomLayout();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
assertEquals(recordingLayout.getFields().size(), 4);
|
assertEquals(4, recordingLayout.getFields().size());
|
||||||
assertEquals(recordingLayout.getName(), "run");
|
assertEquals("run", recordingLayout.getName());
|
||||||
assertEquals(recordingLayout.getColumnsPerRow(), 2);
|
assertEquals(2, recordingLayout.getColumnsPerRow());
|
||||||
|
|
||||||
assertEquals(recordingLayout.getFields().get(0).getKey(), context.getString(R.string.stats_custom_layout_moving_time_key));
|
assertEquals(recordingLayout.getFields().get(0).getKey(), context.getString(R.string.stats_custom_layout_moving_time_key));
|
||||||
assertTrue(recordingLayout.getFields().get(0).isVisible());
|
assertTrue(recordingLayout.getFields().get(0).isVisible());
|
||||||
@@ -169,9 +169,9 @@ public class PreferencesUtilsTest {
|
|||||||
RecordingLayout recordingLayout = PreferencesUtils.getCustomLayout();
|
RecordingLayout recordingLayout = PreferencesUtils.getCustomLayout();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
assertEquals(recordingLayout.getFields().size(), 4);
|
assertEquals(4, recordingLayout.getFields().size());
|
||||||
assertEquals(recordingLayout.getName(), "walking");
|
assertEquals("walking", recordingLayout.getName());
|
||||||
assertEquals(recordingLayout.getColumnsPerRow(), 2);
|
assertEquals(2, recordingLayout.getColumnsPerRow());
|
||||||
|
|
||||||
assertEquals(recordingLayout.getFields().get(0).getKey(), context.getString(R.string.stats_custom_layout_moving_time_key));
|
assertEquals(recordingLayout.getFields().get(0).getKey(), context.getString(R.string.stats_custom_layout_moving_time_key));
|
||||||
assertTrue(recordingLayout.getFields().get(0).isVisible());
|
assertTrue(recordingLayout.getFields().get(0).isVisible());
|
||||||
@@ -266,11 +266,11 @@ public class PreferencesUtilsTest {
|
|||||||
// then only updated profile is modified in the custom layouts
|
// then only updated profile is modified in the custom layouts
|
||||||
List<RecordingLayout> layoutsAfter = PreferencesUtils.getAllCustomLayouts();
|
List<RecordingLayout> layoutsAfter = PreferencesUtils.getAllCustomLayouts();
|
||||||
|
|
||||||
assertEquals(layoutsBefore.size(), 2);
|
assertEquals(2, layoutsBefore.size());
|
||||||
assertEquals(layoutsAfter.size(), 2);
|
assertEquals(2, layoutsAfter.size());
|
||||||
|
|
||||||
assertEquals(layoutsBefore.get(0).getFields().stream().filter(DataField::isVisible).count(), 4);
|
assertEquals(4, layoutsBefore.get(0).getFields().stream().filter(DataField::isVisible).count());
|
||||||
assertEquals(layoutsAfter.get(0).getFields().stream().filter(DataField::isVisible).count(), 1);
|
assertEquals(1, layoutsAfter.get(0).getFields().stream().filter(DataField::isVisible).count());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -309,11 +309,11 @@ public class PreferencesUtilsTest {
|
|||||||
// then only updated profile is modified in the custom layouts
|
// then only updated profile is modified in the custom layouts
|
||||||
List<RecordingLayout> layoutsAfter = PreferencesUtils.getAllCustomLayouts();
|
List<RecordingLayout> layoutsAfter = PreferencesUtils.getAllCustomLayouts();
|
||||||
|
|
||||||
assertEquals(layoutsBefore.size(), 2);
|
assertEquals(2, layoutsBefore.size());
|
||||||
assertEquals(layoutsAfter.size(), 2);
|
assertEquals(2, layoutsAfter.size());
|
||||||
|
|
||||||
assertEquals(layoutsBefore.get(0).getFields().stream().filter(DataField::isVisible).count(), 4);
|
assertEquals(4, layoutsBefore.get(0).getFields().stream().filter(DataField::isVisible).count());
|
||||||
assertEquals(layoutsAfter.get(0).getFields().stream().filter(DataField::isVisible).count(), 1);
|
assertEquals(1, layoutsAfter.get(0).getFields().stream().filter(DataField::isVisible).count());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -341,6 +341,6 @@ public class PreferencesUtilsTest {
|
|||||||
RecordingLayout recordingLayout = PreferencesUtils.getCustomLayout();
|
RecordingLayout recordingLayout = PreferencesUtils.getCustomLayout();
|
||||||
|
|
||||||
// then the first one was returned
|
// then the first one was returned
|
||||||
assertEquals(recordingLayout.getName(), "cycling");
|
assertEquals("cycling", recordingLayout.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -26,11 +26,11 @@ public class CsvRecordingLayoutUtilsTest extends TestCase {
|
|||||||
|
|
||||||
// then
|
// then
|
||||||
assertNotNull(partsOk);
|
assertNotNull(partsOk);
|
||||||
assertEquals(partsOk.size(), 4);
|
assertEquals(4, partsOk.size());
|
||||||
assertEquals(partsOk.get(0), "Layout Name");
|
assertEquals("Layout Name", partsOk.get(0));
|
||||||
assertEquals(partsOk.get(1), "2");
|
assertEquals("2", partsOk.get(1));
|
||||||
assertEquals(partsOk.get(2), "distance,1,1");
|
assertEquals("distance,1,1", partsOk.get(2));
|
||||||
assertEquals(partsOk.get(3), "speed,1,1");
|
assertEquals("speed,1,1", partsOk.get(3));
|
||||||
assertNull(partsWrong1);
|
assertNull(partsWrong1);
|
||||||
assertNull(partsWrong2);
|
assertNull(partsWrong2);
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-12
@@ -32,9 +32,9 @@ public class RecordingLayoutTest extends TestCase {
|
|||||||
List<DataField> dataFieldList = recordingLayout.getFields();
|
List<DataField> dataFieldList = recordingLayout.getFields();
|
||||||
|
|
||||||
// then layout and data fields are built correctly
|
// then layout and data fields are built correctly
|
||||||
assertEquals(recordingLayout.getName(), "running");
|
assertEquals("running", recordingLayout.getName());
|
||||||
assertEquals(recordingLayout.getColumnsPerRow(), 2);
|
assertEquals(2, recordingLayout.getColumnsPerRow());
|
||||||
assertEquals(dataFieldList.size(), 4);
|
assertEquals(4, dataFieldList.size());
|
||||||
assertEquals(dataFieldList.get(0).getKey(), context.getString(R.string.stats_custom_layout_speed_key));
|
assertEquals(dataFieldList.get(0).getKey(), context.getString(R.string.stats_custom_layout_speed_key));
|
||||||
assertEquals(dataFieldList.get(1).getKey(), context.getString(R.string.stats_custom_layout_distance_key));
|
assertEquals(dataFieldList.get(1).getKey(), context.getString(R.string.stats_custom_layout_distance_key));
|
||||||
assertEquals(dataFieldList.get(2).getKey(), context.getString(R.string.stats_custom_layout_altitude_key));
|
assertEquals(dataFieldList.get(2).getKey(), context.getString(R.string.stats_custom_layout_altitude_key));
|
||||||
@@ -66,7 +66,7 @@ public class RecordingLayoutTest extends TestCase {
|
|||||||
// then layout and data fields are built correctly
|
// then layout and data fields are built correctly
|
||||||
assertEquals(recordingLayout.getName(), PreferencesUtils.getDefaultLayoutName());
|
assertEquals(recordingLayout.getName(), PreferencesUtils.getDefaultLayoutName());
|
||||||
assertEquals(recordingLayout.getColumnsPerRow(), PreferencesUtils.getLayoutColumnsByDefault());
|
assertEquals(recordingLayout.getColumnsPerRow(), PreferencesUtils.getLayoutColumnsByDefault());
|
||||||
assertEquals(recordingLayout.getFields().size(), 0);
|
assertEquals(0, recordingLayout.getFields().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -81,7 +81,7 @@ public class RecordingLayoutTest extends TestCase {
|
|||||||
// then layout and data fields are built correctly
|
// then layout and data fields are built correctly
|
||||||
assertEquals(recordingLayout.getName(), PreferencesUtils.getDefaultLayoutName());
|
assertEquals(recordingLayout.getName(), PreferencesUtils.getDefaultLayoutName());
|
||||||
assertEquals(recordingLayout.getColumnsPerRow(), PreferencesUtils.getLayoutColumnsByDefault());
|
assertEquals(recordingLayout.getColumnsPerRow(), PreferencesUtils.getLayoutColumnsByDefault());
|
||||||
assertEquals(recordingLayout.getFields().size(), 0);
|
assertEquals(0, recordingLayout.getFields().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -94,9 +94,9 @@ public class RecordingLayoutTest extends TestCase {
|
|||||||
List<DataField> dataFieldList = recordingLayout.getFields();
|
List<DataField> dataFieldList = recordingLayout.getFields();
|
||||||
|
|
||||||
// then layout and data fields are built correctly
|
// then layout and data fields are built correctly
|
||||||
assertEquals(recordingLayout.getName(), "Layout Name");
|
assertEquals("Layout Name", recordingLayout.getName());
|
||||||
assertEquals(recordingLayout.getColumnsPerRow(), 2);
|
assertEquals(2, recordingLayout.getColumnsPerRow());
|
||||||
assertEquals(recordingLayout.getFields().size(), 0);
|
assertEquals(0, recordingLayout.getFields().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -109,9 +109,9 @@ public class RecordingLayoutTest extends TestCase {
|
|||||||
List<DataField> dataFieldList = recordingLayout.getFields();
|
List<DataField> dataFieldList = recordingLayout.getFields();
|
||||||
|
|
||||||
// then layout and data fields are built correctly
|
// then layout and data fields are built correctly
|
||||||
assertEquals(recordingLayout.getName(), "Layout Name");
|
assertEquals("Layout Name", recordingLayout.getName());
|
||||||
assertEquals(recordingLayout.getColumnsPerRow(), 2);
|
assertEquals(2, recordingLayout.getColumnsPerRow());
|
||||||
assertEquals(recordingLayout.getFields().size(), 1);
|
assertEquals(1, recordingLayout.getFields().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -128,7 +128,7 @@ public class RecordingLayoutTest extends TestCase {
|
|||||||
String csv = recordingLayout.toCsv();
|
String csv = recordingLayout.toCsv();
|
||||||
|
|
||||||
// then csv is well built
|
// then csv is well built
|
||||||
assertEquals(csv, "Test Layout;2;key1,0,0,0;key2,0,1,0;key3,1,0,0;key4,1,1,0;key5,1,1,1;");
|
assertEquals("Test Layout;2;key1,0,0,0;key2,0,1,0;key3,1,0,0;key4,1,1,0;key5,1,1,1;", csv);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user