/** * 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."); } }