DMPAInjectableStrategy implements FPMethodStrategy { @Override public void unEnrollFromPreviousScheduleAsFPMethodChanged(FPProductInformation fpInfo) { logger.info(format("Un-enrolling EC from DMPA Injectable Refill schedule as FP method changed. entityId: {0}, new fp method: {1}", fpInfo.entityId(), fpInfo.currentFPMethod())); scheduleTrackingService.unenroll(fpInfo.entityId(), asList(dmpaInjectableRefillSchedule.name())); actionService.markAlertAsClosed(fpInfo.entityId(), fpInfo.anmId(), dmpaInjectableRefillSchedule.name(), fpInfo.fpMethodChangeDate()); } @Autowired  DMPAInjectableStrategy(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 shouldUnEnrollECFromPreviousRefillSchedule() { strategy.unEnrollFromPreviousScheduleAsFPMethodChanged(new FPProductInformation("entity id 1", "anm id 1", "condom", "dmpa_injectable", null, null, null, null, null, "2012-01-01", null, null, null)); verify(scheduleTrackingService).unenroll("entity id 1", asList("DMPA Injectable Refill")); verify(actionService).markAlertAsClosed("entity id 1", "anm id 1", "DMPA Injectable Refill", "2012-01-01"); }