ANCSchedulesService { public void deliveryHasBeenPlanned(String entityId, String anmId, String deliveryPlanDate) { fulfillMilestoneIfPossible(entityId, anmId, SCHEDULE_DELIVERY_PLAN, SCHEDULE_DELIVERY_PLAN, parse(deliveryPlanDate)); } @Autowired  ANCSchedulesService(ScheduleTrackingService trackingService, ActionService actionService, ScheduleService scheduleService); void enrollMother(String caseId, LocalDate referenceDateForSchedule); void ancVisitHasHappened(String entityId, String anmId, int visitNumberToFulfill, String visitDate); void deliveryHasBeenPlanned(String entityId, String anmId, String deliveryPlanDate); void ttVisitHasHappened(String entityId, String anmId, String ttDose, String ttDate); void ifaTabletsGiven(String entityId, String anmId, String numberOfIFATabletsGiven, String ifaGivenDate); void hbTestDone(String entityId, String anmId, String date, String anaemicStatus, LocalDate lmp); void forceFulfillMilestone(String externalId, String scheduleName); void unEnrollFromAllSchedules(String entityId); static final int NUMBER_OF_WEEKS_BEFORE_HB_TEST_2_BECOMES_DUE; }
@Test public void shouldFulfillScheduleWhenDeliveryHasBeenPlanned() { when(trackingService.getEnrollment("Case X", "Delivery Plan")) .thenReturn(new EnrollmentRecord("Case X", "Delivery Plan", "Delivery Plan", null, null, null, null, null, null, null)); ancSchedulesService.deliveryHasBeenPlanned("Case X", "ANM id 1", "2013-01-01"); verify(trackingService).fulfillCurrentMilestone(eq("Case X"), eq("Delivery Plan"), eq(parse("2013-01-01")), any(Time.class)); }