Add missing tests for RepetitionList and Habit

This commit is contained in:
2017-05-30 08:19:28 -04:00
parent 8a29fbf07d
commit 6ccfb53329
12 changed files with 118 additions and 27 deletions

View File

@@ -73,7 +73,7 @@ public class HabitFixtures
81, 83, 89, 90, 91, 95, 102, 103, 108, 109, 120};
for (int mark : marks)
habit.getRepetitions().toggleTimestamp(today - mark * day);
habit.getRepetitions().toggle(today - mark * day);
return habit;
}
@@ -108,7 +108,7 @@ public class HabitFixtures
long timestamp = DateUtils.getStartOfToday();
for (boolean c : LONG_HABIT_CHECKS)
{
if (c) habit.getRepetitions().toggleTimestamp(timestamp);
if (c) habit.getRepetitions().toggle(timestamp);
timestamp -= DateUtils.millisecondsInOneDay;
}

View File

@@ -108,7 +108,7 @@ public class HabitBullCSVImporter extends AbstractImporter
}
if(!h.getRepetitions().containsTimestamp(timestamp))
h.getRepetitions().toggleTimestamp(timestamp);
h.getRepetitions().toggle(timestamp);
}
}
}

View File

@@ -101,7 +101,7 @@ public class RewireDBImporter extends AbstractImporter
GregorianCalendar cal = DateUtils.getStartOfTodayCalendar();
cal.set(year, month - 1, day);
habit.getRepetitions().toggleTimestamp(cal.getTimeInMillis());
habit.getRepetitions().toggle(cal.getTimeInMillis());
} while (c.moveToNext());
}
finally

View File

@@ -100,7 +100,7 @@ public class TickmateDBImporter extends AbstractImporter
GregorianCalendar cal = DateUtils.getStartOfTodayCalendar();
cal.set(year, month, day);
habit.getRepetitions().toggleTimestamp(cal.getTimeInMillis());
habit.getRepetitions().toggle(cal.getTimeInMillis());
} while (c.moveToNext());
}
finally

View File

@@ -59,7 +59,7 @@ public class WidgetControllerTest extends BaseAndroidUnitTest
@Test
public void testOnAddRepetition_whenChecked() throws Exception
{
habit.getRepetitions().toggleTimestamp(today);
habit.getRepetitions().toggle(today);
int todayValue = habit.getCheckmarks().getTodayValue();
assertThat(todayValue, equalTo(CHECKED_EXPLICITLY));
controller.onAddRepetition(habit, today);
@@ -79,7 +79,7 @@ public class WidgetControllerTest extends BaseAndroidUnitTest
@Test
public void testOnRemoveRepetition_whenChecked() throws Exception
{
habit.getRepetitions().toggleTimestamp(today);
habit.getRepetitions().toggle(today);
int todayValue = habit.getCheckmarks().getTodayValue();
assertThat(todayValue, equalTo(CHECKED_EXPLICITLY));
controller.onRemoveRepetition(habit, today);