@Test
  @Verifies(
      value = "should return program enrollment after specified date",
      method = "getClosestFutureProgramEnrollment(Patient,Program,Date)")
  public void shouldReturnPatientProgramWithEnrollmentAfterSpecifiedDate() throws Exception {
    // load this data set so that we get the additional patient program created in this data case
    executeDataSet(
        XML_DATASET_PATH + new TestUtil().getTestDatasetFilename(XML_REGRESSION_TEST_DATASET));

    ProgramWorkflowService pws = Context.getProgramWorkflowService();
    Patient patient = Context.getPatientService().getPatient(2);
    Program program = pws.getProgram(1);

    Calendar cal = Calendar.getInstance();
    cal.set(2001, 6, 31);
    Date date = cal.getTime();

    PatientProgram pp = HtmlFormEntryUtil.getClosestFutureProgramEnrollment(patient, program, date);
    Assert.assertEquals("32296060-03aa-102d-b0e3-001ec94a0cc5", pp.getUuid());

    // now, if we roll the date back a year earlier, it should get the earlier of the two programs
    // for this patient
    cal.set(2000, 6, 31);
    date = cal.getTime();

    pp = HtmlFormEntryUtil.getClosestFutureProgramEnrollment(patient, program, date);
    Assert.assertEquals("32596060-03aa-102d-b0e3-001ec94a0cc5", pp.getUuid());
  }
 @Test
 @Verifies(
     value = "should return null if no program enrollment after specified date",
     method = "getClosestFutureProgramEnrollment(Patient,Program,Date)")
 public void
     getClosestFutureProgramEnrollment_shouldReturnNullIfNoProgramEnrollmentAfterSpecifiedDate()
         throws Exception {
   ProgramWorkflowService pws = Context.getProgramWorkflowService();
   Patient patient = Context.getPatientService().getPatient(2);
   Program program = pws.getProgram(1);
   Assert.assertNull(
       HtmlFormEntryUtil.getClosestFutureProgramEnrollment(patient, program, new Date()));
 }
 @Test
 @Verifies(
     value = "should return null if program enrollment date same as specified date",
     method = "getClosestFutureProgramEnrollment(Patient,Program,Date)")
 public void
     getClosestFutureProgramEnrollment_shouldReturnNullIfProgramEnrollmentSameAsSpecifiedDate()
         throws Exception {
   ProgramWorkflowService pws = Context.getProgramWorkflowService();
   Patient patient = Context.getPatientService().getPatient(2);
   Program program = pws.getProgram(1);
   Date date = pws.getPatientProgram(1).getDateEnrolled();
   Assert.assertNull(HtmlFormEntryUtil.getClosestFutureProgramEnrollment(patient, program, date));
 }