diff --git a/iTrust/test/edu/ncsu/csc/itrust/unit/action/AddPreRegisterPatientActionTest.java b/iTrust/test/edu/ncsu/csc/itrust/unit/action/AddPreRegisterPatientActionTest.java index f7d9d1b20cd4ad1b7dc72c340dd0dd1f34e243d8..c5cf6099ea011acadb1c337a6e2cbb54fc27c9b4 100644 --- a/iTrust/test/edu/ncsu/csc/itrust/unit/action/AddPreRegisterPatientActionTest.java +++ b/iTrust/test/edu/ncsu/csc/itrust/unit/action/AddPreRegisterPatientActionTest.java @@ -95,4 +95,35 @@ public class AddPreRegisterPatientActionTest extends TestCase { } } + + /** + * Ensure that duplicate emails are not allowed + */ + public void testPreRegisterPatientDuplicateEmail() throws Exception { + PatientBean p2 = new PatientBean(); + p2.setFirstName("Jiminy"); + p2.setLastName("Cricket"); + p2.setEmail("make.awish@gmail.com"); + p2.setPassword("password"); + + action.addPatient(p2); + + PatientBean p3 = new PatientBean(); + p3.setFirstName("Make"); + p3.setLastName("AWish"); + p3.setEmail("make.awish@gmail.com"); + p3.setPassword("password"); + + try { + action.addPatient(p3); + fail("Duplicate email"); + } catch (ITrustException e) { } + } + + /** + * Check that invalid names are not allowed + */ + public void testPreRegisterPatientInvalidName() throws Exception { + + } }