ANCSchedulesService { public void ancVisitHasHappened(String entityId, String anmId, int visitNumberToFulfill, String visitDate) { fastForwardSchedule(entityId, anmId, SCHEDULE_ANC, SCHEDULE_ANC_MILESTONE_PREFIX, visitNumberToFulfill, parse(visitDate)); } @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 shouldNotFulfillANCIfANCScheduleIsAlreadyOver() throws Exception { when(trackingService.getEnrollment("Entity X", SCHEDULE_ANC)).thenReturn(null); ancSchedulesService.ancVisitHasHappened("Entity X", "ANM 1", 2, "2012-01-23"); verify(trackingService).getEnrollment("Entity X", SCHEDULE_ANC); verifyNoMoreInteractions(trackingService); verifyZeroInteractions(actionService); }