Source:
<code>protected ActionResult execute() throws EntityDoesNotExistException { String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); String previewInstructorEmail = getRequestParamValue(Const.ParamsNames.PREVIEWAS); <START> <END> new GateKeeper().verifyAccessible( logic.getInstructorForGoogleId(courseId, account.googleId), logic.getFeedbackSession(feedbackSessionName, courseId), true); InstructorAttributes previewInstructor = logic.getInstructorForEmail(courseId, previewInstructorEmail); if (previewInstructor == null) { throw new EntityDoesNotExistException("Instructor Email " + previewInstructorEmail + " does not exist in " + courseId + "."); } FeedbackSubmissionEditPageData data = new FeedbackSubmissionEditPageData(account); data.bundle = logic.getFeedbackSessionQuestionsBundleForInstructor( feedbackSessionName, courseId, previewInstructor.email); if (data.bundle == null) { throw new EntityDoesNotExistException("Feedback session " + feedbackSessionName + " does not exist in " + courseId + "."); } data.isSessionOpenForSubmission = true; data.isPreview = true; data.previewInstructor = previewInstructor; data.bundle.resetAllResponses(); statusToAdmin = "Preview feedback session as instructor (" + previewInstructor.email + ")<br>" + "Session Name: " + feedbackSessionName + "<br>" + "Course ID: " + courseId; return createShowPageResult(Const.ViewURIs.INSTRUCTOR_FEEDBACK_SUBMISSION_EDIT, data); }</code><technical_language>check for null here. write tests for checks</technical_language>

Target:
protected ActionResult execute() throws EntityDoesNotExistException { String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); String previewInstructorEmail = getRequestParamValue(Const.ParamsNames.PREVIEWAS); Assumption.assertNotNull(String.format(Const.StatusMessages.NULL_POST_PARAMETER_MESSAGE, Const.ParamsNames.COURSE_ID), courseId); Assumption.assertNotNull(String.format(Const.StatusMessages.NULL_POST_PARAMETER_MESSAGE, Const.ParamsNames.FEEDBACK_SESSION_NAME), feedbackSessionName); Assumption.assertNotNull(String.format(Const.StatusMessages.NULL_POST_PARAMETER_MESSAGE, Const.ParamsNames.PREVIEWAS), previewInstructorEmail); new GateKeeper().verifyAccessible( logic.getInstructorForGoogleId(courseId, account.googleId), logic.getFeedbackSession(feedbackSessionName, courseId), true); InstructorAttributes previewInstructor = logic.getInstructorForEmail(courseId, previewInstructorEmail); if (previewInstructor == null) { throw new EntityDoesNotExistException("Instructor Email " + previewInstructorEmail + " does not exist in " + courseId + "."); } FeedbackSubmissionEditPageData data = new FeedbackSubmissionEditPageData(account); data.bundle = logic.getFeedbackSessionQuestionsBundleForInstructor( feedbackSessionName, courseId, previewInstructor.email); if (data.bundle == null) { throw new EntityDoesNotExistException("Feedback session " + feedbackSessionName + " does not exist in " + courseId + "."); } data.isSessionOpenForSubmission = true; data.isPreview = true; data.previewInstructor = previewInstructor; data.bundle.resetAllResponses(); statusToAdmin = "Preview feedback session as instructor (" + previewInstructor.email + ")<br>" + "Session Name: " + feedbackSessionName + "<br>" + "Course ID: " + courseId; return createShowPageResult(Const.ViewURIs.INSTRUCTOR_FEEDBACK_SUBMISSION_EDIT, data); }