OCPStrategy implements FPMethodStrategy { @Override public void registerEC(FPProductInformation fpInfo) { enrollECToOCPRefillSchedule(fpInfo.entityId(), fpInfo.numberOfOCPStripsSupplied(), fpInfo.ocpRefillDate()); } @Autowired  OCPStrategy(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); static final int NUMBER_OF_PILLS_IN_ONE_OCP_STRIP; static final int DUE_WINDOW_PERIOD_IN_WEEKS; }
@Test public void shouldEnrollInOCPScheduleAndGenerateUpcomingAlertOnECRegistration() throws Exception { fakeIt(parse("2012-02-01")); strategy.registerEC(new FPProductInformation("entity id 1", "anm id 1", "ocp", null, null, "1", "2012-01-01" , "20", "2012-03-01", null, null, null, null)); verify(actionService).alertForBeneficiary(ec, "entity id 1", "OCP Refill", "OCP Refill", upcoming, LocalDate.parse("2012-01-15").toDateTime(new LocalTime(14, 0)), LocalDate.parse("2012-01-15").plusWeeks(1).toDateTime(new LocalTime(14, 0))); verify(scheduleService).enroll("entity id 1", "OCP Refill", "2012-01-15"); strategy.registerEC(new FPProductInformation("entity id 1", "anm id 1", "ocp", null, null, "2", "2012-01-01" , "20", "2012-03-01", null, null, null, null)); verify(actionService).alertForBeneficiary(ec, "entity id 1", "OCP Refill", "OCP Refill", upcoming, LocalDate.parse("2012-02-12").toDateTime(new LocalTime(14, 0)), LocalDate.parse("2012-02-12").plusWeeks(1).toDateTime(new LocalTime(14, 0))); verify(scheduleService).enroll("entity id 1", "OCP Refill", "2012-02-12"); strategy.registerEC(new FPProductInformation("entity id 1", "anm id 1", "ocp", null, null, "0", "2012-01-01" , "20", "2012-03-01", null, null, null, null)); verify(actionService).alertForBeneficiary(ec, "entity id 1", "OCP Refill", "OCP Refill", upcoming, LocalDate.parse("2012-02-01").toDateTime(new LocalTime(14, 0)), LocalDate.parse("2012-02-01").plusWeeks(1).toDateTime(new LocalTime(14, 0))); verify(scheduleService).enroll("entity id 1", "OCP Refill", "2012-02-01"); }