@Test public void shouldFulfillAMilestoneAndAlertsForTheOneDueNext() { LocalDate enrollmentDate = LocalDate.now().minusWeeks(16); LocalDate firstFulfillmentDate = LocalDate.now().minusWeeks(3); Enrollment enrollment = schedule.newEnrollment("External ID", enrollmentDate); String nextMilestone = enrollment.fulfillMilestone(schedule, firstFulfillmentDate); assertThat(nextMilestone, is(equalTo("IPTI 2"))); List<Alert> alerts = enrollment.getAlerts(schedule); assertThat(alerts.size(), is(equalTo(1))); Alert alert = alerts.get(0); assertThat(alert.windowName(), is(equalTo(WindowName.Due))); Map<String, String> data = alert.data(); assertThat(data.get("doo"), is(equalTo("Bar"))); }
private List<Alert> enrollAndGetAlerts(int numberOfWeeksSinceEnrollment) { LocalDate fewWeeksAgo = LocalDate.now().minusWeeks(numberOfWeeksSinceEnrollment); Enrollment enrollment = schedule.newEnrollment("External ID", fewWeeksAgo); return enrollment.getAlerts(schedule); }