### Question:
MainController { public void updateHabitsProgress(Set<MiniHabit> doneHabits, DateAtMidnight feedbackDate) { Set<MiniHabit> allHabits = repository.findAll(); for (MiniHabit miniHabit : allHabits) { if (doneHabits.contains(miniHabit)) miniHabit.incDaysInProgress(); else miniHabit.resetProgress(); } repository.update(allHabits); repository.updateProgressDate(feedbackDate); } MainController(Repository repository); void updateHabitsProgress(Set<MiniHabit> doneHabits, DateAtMidnight feedbackDate); DateAtMidnight nextFeedbackDate(DateAtMidnight currentDate); void addHabit(MiniHabit miniHabit); Collection<MiniHabit> allHabits();  }### Answer:
@Test public void update_habits_progress() { final Set<MiniHabit> aSetOfDoneHabits = new LinkedHashSet<MiniHabit>(); final Set<MiniHabit> allHabits = new LinkedHashSet<MiniHabit>(); final DateAtMidnight aDate = DateAtMidnight.from(DateFactory.date("20 Apr 2017")); context.checking(new Expectations() {{ oneOf(repository).findAll(); will(returnValue(allHabits)); oneOf(repository).update(allHabits); oneOf(repository).updateProgressDate(aDate); }}); controller.updateHabitsProgress(aSetOfDoneHabits, aDate); }