FemaleSterilizationStrategy implements FPMethodStrategy { @Override public void fpFollowup(FPProductInformation fpInfo) { String currentMilestone = getCurrentMilestone(fpInfo); logger.info(format("Fulfilling current milestone For Female sterilization Followup schedule. entityId: {0}, Ref date: {1}, currentMilestone: {2}", fpInfo.entityId(), fpInfo.submissionDate(), currentMilestone)); scheduleTrackingService.fulfillCurrentMilestone(fpInfo.entityId(), femaleSterilizationFollowupSchedule.name(), parse(fpInfo.fpFollowupDate())); actionService.markAlertAsClosed(fpInfo.entityId(), fpInfo.anmId(), currentMilestone, fpInfo.fpFollowupDate()); } @Autowired  FemaleSterilizationStrategy(ScheduleTrackingService scheduleTrackingService, ActionService actionService, ScheduleService scheduleService); @Override void registerEC(FPProductInformation fpInfo); @Override void unEnrollFromPreviousScheduleAsFPMethodChanged(FPProductInformation fpInfo); @Override void enrollToNewScheduleForNewFPMethod(FPProductInformation fpInfo); @Override void renewFPProduct(FPProductInformation fpInfo); @Override void fpFollowup(FPProductInformation fpInfo);  }
@Test public void shouldFastForwardFemaleSterilizationFollowupScheduleOnFPFollowup() throws Exception { when(scheduleTrackingService.getEnrollment("entity id 1", "Female sterilization Followup")).thenReturn(new EnrollmentRecord( "entity id 1", "Female sterilization Followup", "Female sterilization Followup 2", null, null, null, null, null, null, null )); strategy.fpFollowup(new FPProductInformation("entity id 1", "anm x", "female_sterilization", null, null, null, null, null, "2012-03-01", null, "2012-02-01", null, null)); InOrder inOrder = inOrder(scheduleTrackingService, actionService); inOrder.verify(scheduleTrackingService).getEnrollment("entity id 1", "Female sterilization Followup"); inOrder.verify(scheduleTrackingService).fulfillCurrentMilestone("entity id 1", "Female sterilization Followup", LocalDate.parse("2012-02-01")); inOrder.verify(actionService).markAlertAsClosed("entity id 1", "anm x", "Female sterilization Followup 2", "2012-02-01"); }