FemaleSterilizationStrategy implements FPMethodStrategy { @Override public void unEnrollFromPreviousScheduleAsFPMethodChanged(FPProductInformation fpInfo) { logger.info(format("Un-enrolling EC from Female sterilization Followup schedule as FP method changed. entityId: {0}, new fp method: {1}", fpInfo.entityId(), fpInfo.currentFPMethod())); unEnrollECFromFemaleSterilizationSchedule(fpInfo.entityId(), fpInfo.anmId(), fpInfo.fpMethodChangeDate()); } @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 shouldUnEnrollFromFemaleSterilizationFollowupScheduleOnFPMethodChange() throws Exception { strategy.unEnrollFromPreviousScheduleAsFPMethodChanged( new FPProductInformation("entity id 1", "anm x", "condom", "female_sterilization", null, null, null, "20", "2012-03-01", "2012-03-10", null, null, null)); verify(scheduleTrackingService).unenroll("entity id 1", asList("Female sterilization Followup")); verify(actionService).markAlertAsClosed("entity id 1", "anm x", "Female sterilization Followup", "2012-03-10"); }