/**
   * testDeletePatientInstructions
   *
   * @throws Exception
   */
  public void testDeletePatientInstructions() throws Exception {
    // Without an Office visit ID, this should throw.
    action = new EditPatientInstructionsAction(factory, 9000000000L, "2");
    try {
      action.deletePatientInstructions(bean);
      fail("Expected an exception.");
    } catch (ITrustException e) {
      assertEquals("Cannot perform action.  OfficeVisit is not saved.", e.getMessage());
    }

    // Try deleting patient specific instructions.
    gen.uc44_acceptance_scenario_2();
    action = new EditPatientInstructionsAction(factory, 9000000004L, "1", "44100");
    assertEquals(1, action.getPatientInstructions().size());
    bean.setId(44100);
    action.deletePatientInstructions(bean);
    assertEquals(0, action.getPatientInstructions().size());
  }
  /**
   * testAddPatientInstructions
   *
   * @throws Exception
   */
  public void testAddPatientInstructions() throws Exception {
    // Without an Office visit ID, this should throw.
    action = new EditPatientInstructionsAction(factory, 9000000000L, "2");
    try {
      action.addPatientInstructions(bean);
      fail("Expected an exception.");
    } catch (ITrustException e) {
      assertEquals("Cannot perform action.  OfficeVisit is not saved.", e.getMessage());
    }

    // Try adding patient specific instructions.
    action = new EditPatientInstructionsAction(factory, 9000000000L, "2", "952");
    assertEquals(0, action.getPatientInstructions().size());
    bean.setName("This is an instruction name.");
    bean.setComment("This is an instruction comment.");
    bean.setUrl("http://example.com/");
    bean.setVisitID(952);
    bean.setModified(new Date());
    action.addPatientInstructions(bean);
    assertEquals(1, action.getPatientInstructions().size());
    assertEquals("This is an instruction name.", action.getPatientInstructions().get(0).getName());
  }
  /**
   * testValidate
   *
   * @throws Exception
   */
  public void testValidate() throws Exception {
    // Without an Office visit ID, this should throw.
    action = new EditPatientInstructionsAction(factory, 9000000000L, "2");
    try {
      action.validate(bean);
      fail("Expected an exception.");
    } catch (ITrustException e) {
      assertEquals("Cannot perform action.  OfficeVisit is not saved.", e.getMessage());
    }

    // Try validating patient specific instructions.
    gen.uc44_acceptance_scenario_2();
    action = new EditPatientInstructionsAction(factory, 9000000004L, "1", "44100");
    bean.setName("This is an instruction name.");
    bean.setComment("This is an instruction comment.");
    bean.setUrl("http://example.com/");
    bean.setVisitID(952);
    bean.setModified(new Date());
    try {
      action.validate(bean);
    } catch (FormValidationException e) {
      fail("Expected validation to succeed.");
    }
  }
 public void testGetPatientInstructions() throws Exception {
   // Without an Office visit ID, this should return an empty list.
   action = new EditPatientInstructionsAction(factory, 9000000000L, "2");
   assertEquals(0, action.getPatientInstructions().size());
 }