Bug 1292359 - Treat visit type consistently as a Long while syncing r=nalexander

MozReview-Commit-ID: ESn4t3lznNl

--HG--
extra : rebase_source : 4f049192cfffe26d4b4392b242840a10d7207828
This commit is contained in:
Grigory Kruglov 2016-08-05 13:05:01 -07:00
Родитель 1d69e33b22
Коммит fa7938e7a8
2 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -78,7 +78,7 @@ public class VisitsHelper {
while (!cursor.isAfterLast()) {
insertTupleIntoVisitsUnchecked(visits,
cursor.getInt(visitTypeCol),
cursor.getLong(visitTypeCol),
cursor.getLong(dateVisitedCol)
);
cursor.moveToNext();
@ -114,7 +114,7 @@ public class VisitsHelper {
}
@SuppressWarnings("unchecked")
private static void insertTupleIntoVisitsUnchecked(JSONArray visits, Integer type, Long date) {
private static void insertTupleIntoVisitsUnchecked(@NonNull final JSONArray visits, @NonNull Long type, @NonNull Long date) {
final JSONObject visit = new JSONObject();
visit.put(SYNC_TYPE_KEY, type);
visit.put(SYNC_DATE_KEY, date);

Просмотреть файл

@ -85,9 +85,9 @@ public class VisitsHelperTest {
for (int i = 0; i < recentVisits.size(); i++) {
JSONObject v = (JSONObject) recentVisits.get(i);
Long date = (Long) v.get("date");
Integer type = (Integer) v.get("type");
Long type = (Long) v.get("type");
Assert.assertEquals(Long.valueOf(baseDate - i * 100), date);
Assert.assertEquals(Integer.valueOf(1), type);
Assert.assertEquals(Long.valueOf(1), type);
}
} finally {
provider.shutdown();