public void init() {
    ContextInfo contextInfo = new ContextInfo();
    contextInfo.setPrincipalId("Test-Initializer");

    CourseInfo course1 =
        this._createCourse("ENGL101", "ENGL", "101", "English 101", "3", contextInfo);
  }
  @Before
  public void setUp() throws Exception {
    callContext = new ContextInfo();
    callContext.setPrincipalId(principalId);
    new CourseR1TestDataLoader(this.courseService).loadData();
    new LuiServiceDataLoader(this.luiService).loadData();

    // due to KSENROLL-4185, data must be loaded into the mock Atp and mock Acal services
    AcalTestDataLoader acalLoader = new AcalTestDataLoader(this.atpService);
    acalLoader.loadTerm(
        "testAtpId1",
        "test1",
        "2000-01-01 00:00:00.0",
        "2100-12-31 00:00:00.0",
        AtpServiceConstants.ATP_FALL_TYPE_KEY,
        AtpServiceConstants.ATP_OFFICIAL_STATE_KEY,
        "description 1");
    new MockAcalTestDataLoader(this.acalService).loadData();
    new MockLrcTestDataLoader(this.lrcService).loadData();

    createStateTestData();
  }
  @Test
  /*
   * If the student is attempting to register too late, the only field provided will be "endDate", which will be set as
   * the last available registration date formatted as a String M/dd/yyyy.
   *
   * Scenario:
   * -- Student is registering on 9/20
   * -- Non-appointment early registration set up 9/16-9/17
   * -- Scheduled adjustment period set up 9/18-9/19
   *
   * Expected result:
   * -- Student is given 9/19 as the registration end date
   */
  public void testTooLate() throws Exception {
    contextInfo.setCurrentDate(new DateTime(2014, 9, 20, 10, 18).toDate());

    CourseAddDates courseAddDates = getCourseAddDates();

    assertNotNull(courseAddDates);
    assertNotNull(courseAddDates.getEndDate());
    assertEquals("9/19/2014", courseAddDates.getEndDate());
  }
 private ContextInfo getContext(String userId) {
   ContextInfo context = new ContextInfo();
   context.setPrincipalId(userId);
   return context;
 }
  @Before
  public void setUp() throws Exception {

    // create the term resolver
    courseAddDatesTermResolver = new CourseAddDatesTermResolver();

    // set up pre-requisites
    contextInfo = new ContextInfo();
    contextInfo.setCurrentDate(new DateTime(2014, 9, 15, 10, 18).toDate());
    String personId = "MOCK.PERSON";
    String atpId = "MOCK.ATP";
    resolvedPrereqs = new HashMap<>();
    resolvedPrereqs.put(RulesExecutionConstants.CONTEXT_INFO_TERM.getName(), contextInfo);
    resolvedPrereqs.put(RulesExecutionConstants.PERSON_ID_TERM.getName(), personId);
    resolvedPrereqs.put(RulesExecutionConstants.ATP_ID_TERM.getName(), atpId);

    // set up parameters
    parameters = new HashMap<>();

    // set up milestones
    List<MilestoneInfo> earlyRegMilestones = new ArrayList<>();
    String mstoneEarlyRegId = "milestone-early-reg";
    mstoneEarlyReg = new MilestoneInfo();
    mstoneEarlyReg.setId(mstoneEarlyRegId);
    earlyRegMilestones.add(mstoneEarlyReg);

    nonApptMilestones = new ArrayList<>();
    String mstoneNonApptId = "milestone-non-appt";
    MilestoneInfo mstoneNonAppt = new MilestoneInfo();
    mstoneNonAppt.setId(mstoneNonApptId);
    mstoneNonAppt.setStartDate(new DateTime(2014, 9, 16, 0, 1).toDate());
    mstoneNonAppt.setEndDate(new DateTime(2014, 9, 17, 11, 59).toDate());
    nonApptMilestones.add(mstoneNonAppt);

    List<MilestoneInfo> schedAdjMilestones = new ArrayList<>();
    String mstoneSchedAdjId = "milestone-sched-adj";
    MilestoneInfo mstoneSchedAdj = new MilestoneInfo();
    mstoneSchedAdj.setId(mstoneSchedAdjId);
    mstoneSchedAdj.setStartDate(new DateTime(2014, 9, 18, 0, 1).toDate());
    mstoneSchedAdj.setEndDate(new DateTime(2014, 9, 19, 11, 59).toDate());
    schedAdjMilestones.add(mstoneSchedAdj);

    // set up atp service
    AtpService atpService = mock(AtpService.class);
    when(atpService.getMilestonesByTypeForAtp(
            atpId, AtpServiceConstants.MILESTONE_EARLY_REGISTRATION_PERIOD_TYPE_KEY, contextInfo))
        .thenReturn(earlyRegMilestones);
    when(atpService.getMilestonesByTypeForAtp(
            atpId,
            AtpServiceConstants.MILESTONE_EARLY_REGISTRATION_PERIOD_NONAPPT_TYPE_KEY,
            contextInfo))
        .thenReturn(nonApptMilestones);
    when(atpService.getMilestonesByTypeForAtp(
            atpId, AtpServiceConstants.MILESTONE_SCHEDULE_ADJUSTMENT_PERIOD_TYPE_KEY, contextInfo))
        .thenReturn(schedAdjMilestones);

    // set up appointment slots
    appointmentSlots = new ArrayList<>();

    // set up appointment service
    AppointmentService appointmentService = mock(AppointmentService.class);
    when(appointmentService.getAppointmentSlotsByPersonAndPeriod(
            personId, mstoneEarlyRegId, contextInfo))
        .thenReturn(appointmentSlots);

    // add services to the term resolver
    courseAddDatesTermResolver.setAtpService(atpService);
    courseAddDatesTermResolver.setAppointmentService(appointmentService);
  }