Source:
private void testGetFeedbackQuestionBundleForInstructor() throws Exception{ ______TS("typical success case"); FeedbackQuestionBundle fqBundle = null; FeedbackQuestionAttributes fqa = getQuestionFromDatastore("qn3InSession1InCourse1"); fqBundle = fqLogic.getFeedbackQuestionBundleForInstructor( "First feedback session", "idOfTypicalCourse1", fqa.getId(), "instructor1@course1.com"); assertEquals(fqBundle.feedbackSession.courseId,"idOfTypicalCourse1"); assertEquals(fqBundle.feedbackSession.feedbackSessionName,"First feedback session"); assertEquals(fqBundle.question.questionNumber, 3); assertEquals(fqBundle.recipientList.size(), 1); assertEquals(fqBundle.responseList.size(), 1); ______TS("non-existent feedback session"); try { fqBundle = fqLogic.getFeedbackQuestionBundleForInstructor( "non-existent feedback session", "idOfTypicalCourse1", fqa.getId(), "instructor1@course1.com"); signalFailureToDetectException(); } catch (EntityDoesNotExistException e) { assertEquals(e.getMessage(),"Trying to get a feedback session that does not exist."); } ______TS("non-existent feedback question"); try { fqBundle = fqLogic.getFeedbackQuestionBundleForInstructor( "First feedback session", "idOfTypicalCourse1", "non-existent fq id", "instructor1@course1.com"); signalFailureToDetectException(); } catch (EntityDoesNotExistException e) { assertEquals(e.getMessage(),"Trying to get a feedback question that does not exist."); } ______TS("question not meant for user"); fqa = getQuestionFromDatastore("qn1InSession1InCourse1"); try { fqBundle = fqLogic.getFeedbackQuestionBundleForInstructor( "First feedback session", "idOfTypicalCourse1", fqa.getId(), "instructor1@course1.com"); signalFailureToDetectException(); } catch(EntityDoesNotExistException e){ signalDetectionOfWrongException("Unexpected EntityDoesNotExistExcpetion: " + e.getMessage()); } catch (UnauthorizedAccessException e) { assertEquals(e.getMessage(),"Trying to access a question not meant for the user."); } }

Target:
private void testGetFeedbackQuestionBundleForInstructor() throws Exception{ ______TS("typical success case"); FeedbackQuestionBundle fqBundle = null; FeedbackQuestionAttributes fqa = getQuestionFromDatastore("qn3InSession1InCourse1"); fqBundle = fqLogic.getFeedbackQuestionBundleForInstructor( "First feedback session", "idOfTypicalCourse1", fqa.getId(), "instructor1@course1.com"); assertEquals(fqBundle.feedbackSession.courseId,"idOfTypicalCourse1"); assertEquals(fqBundle.feedbackSession.feedbackSessionName,"First feedback session"); assertEquals(fqBundle.question.questionNumber, 3); assertEquals(fqBundle.recipientList.size(), 1); assertEquals(fqBundle.responseList.size(), 1); ______TS("non-existent feedback session"); try { fqBundle = fqLogic.getFeedbackQuestionBundleForInstructor( "non-existent feedback session", "idOfTypicalCourse1", fqa.getId(), "instructor1@course1.com"); signalFailureToDetectException(); } catch (EntityDoesNotExistException e) { assertEquals(e.getMessage(),"Trying to get a feedback session that does not exist."); } ______TS("non-existent feedback question"); try { fqBundle = fqLogic.getFeedbackQuestionBundleForInstructor( "First feedback session", "idOfTypicalCourse1", "non-existent fq id", "instructor1@course1.com"); signalFailureToDetectException(); } catch (EntityDoesNotExistException e) { assertEquals(e.getMessage(),"Trying to get a feedback question that does not exist."); } ______TS("question not meant for user"); fqa = getQuestionFromDatastore("qn1InSession1InCourse1"); try { fqBundle = fqLogic.getFeedbackQuestionBundleForInstructor( "First feedback session", "idOfTypicalCourse1", fqa.getId(), "instructor1@course1.com"); signalFailureToDetectException(); } catch (UnauthorizedAccessException e) { assertEquals(e.getMessage(),"Trying to access a question not meant for the user."); } }