CondomStrategy implements FPMethodStrategy { @Override public void unEnrollFromPreviousScheduleAsFPMethodChanged(FPProductInformation fpInfo) { logger.info(format("Un-enrolling EC from Condom Refill schedule as FP method changed. entityId: {0}, new fp method: {1}", fpInfo.entityId(), fpInfo.currentFPMethod())); scheduleTrackingService.unenroll(fpInfo.entityId(), asList(condomRefillSchedule.name())); actionService.markAlertAsClosed(fpInfo.entityId(), fpInfo.anmId(), condomRefillSchedule.name(), fpInfo.fpMethodChangeDate()); } @Autowired  CondomStrategy(ScheduleTrackingService scheduleTrackingService, ActionService actionService, ScheduleService scheduleService,
                          @Value("#{drishti['preferred.time']}") int preferredTime); @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 shouldUnEnrollECFromPreviousRefillSchedule() { strategy.unEnrollFromPreviousScheduleAsFPMethodChanged(new FPProductInformation("entity id 1", "anm id 1", "ocp", "condom", null, "1", null, null, null, "2012-01-01", null, null, null)); verify(scheduleTrackingService).unenroll("entity id 1", asList("Condom Refill")); verify(actionService).markAlertAsClosed("entity id 1", "anm id 1", "Condom Refill", "2012-01-01"); }