Source:
public void testAddInstructor() throws Exception { ______TS("success: add an instructor"); String googleId = null; String courseId = "test-course"; String name = "New Instructor"; String email = "ILT.instr@email.tmt"; String role = Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER; String displayedName = InstructorAttributes.DEFAULT_DISPLAY_NAME; InstructorPrivileges privileges = new InstructorPrivileges(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER); InstructorAttributes instr = new InstructorAttributes(googleId, courseId, name, email, role, displayedName, privileges); instructorsLogic.createInstructor(instr); verifyPresentInDatastore(instr); ______TS("failure: instructor already exists"); try { instructorsLogic.createInstructor(instr); signalFailureToDetectException(); } catch (EntityAlreadyExistsException e) { AssertHelper.assertContains("Trying to create a Instructor that exists", e.getMessage()); } instructorsLogic.deleteInstructorCascade(instr.courseId, instr.email); ______TS("failure: invalid parameter"); instr.email = "invalidEmail.tmt"; String expectedError = getPopulatedErrorMessage( FieldValidator.EMAIL_ERROR_MESSAGE, instr.email, FieldValidator.EMAIL_FIELD_NAME, FieldValidator.REASON_INCORRECT_FORMAT, FieldValidator.EMAIL_MAX_LENGTH); try { instructorsLogic.createInstructor(instr); signalFailureToDetectException(); } catch (InvalidParametersException e) { assertEquals(expectedError, e.getMessage()); } ______TS("failure: null parameters"); try { instructorsLogic.createInstructor(null); signalFailureToDetectException(); } catch (AssertionError e) { AssertHelper.assertContains("Supplied parameter was null", e.getMessage()); } }

Target:
public void testAddInstructor() throws Exception { ______TS("success: add an instructor"); String googleId = null; String courseId = "test-course"; String name = "New Instructor"; String email = "ILT.instr@email.tmt"; String role = Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER; String displayedName = InstructorAttributes.DEFAULT_DISPLAY_NAME; InstructorPrivileges privileges = new InstructorPrivileges(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER); InstructorAttributes instr = new InstructorAttributes(googleId, courseId, name, email, role, displayedName, privileges); instructorsLogic.createInstructor(instr); verifyPresentInDatastore(instr); ______TS("failure: instructor already exists"); try { instructorsLogic.createInstructor(instr); signalFailureToDetectException(); } catch (EntityAlreadyExistsException e) { AssertHelper.assertContains("Trying to create a Instructor that exists", e.getMessage()); } instructorsLogic.deleteInstructorCascade(instr.courseId, instr.email); ______TS("failure: invalid parameter"); instr.email = "invalidEmail.tmt"; String expectedError = "\"" + instr.email + "\" is not acceptable to TEAMMATES as a/an email " + "because it is not in the correct format. An email address contains " + "some text followed by one '@' sign followed by some more text. " + "It cannot be longer than 254 characters, cannot be empty and " + "cannot contain spaces."; try { instructorsLogic.createInstructor(instr); signalFailureToDetectException(); } catch (InvalidParametersException e) { assertEquals(expectedError, e.getMessage()); } ______TS("failure: null parameters"); try { instructorsLogic.createInstructor(null); signalFailureToDetectException(); } catch (AssertionError e) { AssertHelper.assertContains("Supplied parameter was null", e.getMessage()); } }