CondomStrategy implements FPMethodStrategy { @Override public void registerEC(FPProductInformation fpInfo) { enrollECToCondomRefillSchedule(fpInfo.entityId()); } @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 shouldEnrollInCondomScheduleOnECRegistration() throws Exception { fakeIt(parse("2012-01-15")); strategy.registerEC(new FPProductInformation("entity id 1", "anm id 1", "condom", null, "2012-01-15", null, null , "20", "2012-03-01", null, null, null, null)); verify(scheduleService).enroll("entity id 1", "Condom Refill", "2012-02-01"); verify(actionService).alertForBeneficiary(ec, "entity id 1", "Condom Refill", "Condom Refill", upcoming, dateTime("2012-02-01"), dateTime("2012-02-08")); fakeIt(parse("2012-12-01")); strategy.registerEC(new FPProductInformation("entity id 1", "anm id 1", "condom", null, "2012-12-01", null, null , "20", "2012-03-01", null, null, null, null)); verify(scheduleService).enroll("entity id 1", "Condom Refill", "2013-01-01"); verify(actionService).alertForBeneficiary(ec, "entity id 1", "Condom Refill", "Condom Refill", upcoming, dateTime("2013-01-01"), dateTime("2013-01-08")); }