Source:
private void testGetFeedbackQuestionBundleForStudent() throws Exception{ ______TS("typical success case"); FeedbackQuestionAttributes fqa = getQuestionFromDatastore("qn1InSession1InCourse1"); FeedbackQuestionBundle fqBundle = fqLogic.getFeedbackQuestionBundleForStudent( "First feedback session", "idOfTypicalCourse1", fqa.getId(), "student1InCourse1@gmail.com"); assertEquals(fqBundle.feedbackSession.courseId,"idOfTypicalCourse1"); assertEquals(fqBundle.feedbackSession.feedbackSessionName,"First feedback session"); assertEquals(fqBundle.question.questionNumber, 1); assertEquals(fqBundle.recipientList.size(), 1); assertEquals(fqBundle.responseList.size(), 1); ______TS("non-existent feedback session"); try { fqBundle = fqLogic.getFeedbackQuestionBundleForStudent( "non-existent feedback session", "idOfTypicalCourse1", fqa.getId(), "student1InCourse1@gmail.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.getFeedbackQuestionBundleForStudent( "First feedback session", "idOfTypicalCourse1", "non-existent fq id", "student1InCourse1@gmail.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("qn3InSession1InCourse1"); try { fqBundle = fqLogic.getFeedbackQuestionBundleForStudent( "First feedback session", "idOfTypicalCourse1", fqa.getId(), "student1InCourse1@gmail.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 testGetFeedbackQuestionBundleForStudent() throws Exception{ ______TS("typical success case"); FeedbackQuestionAttributes fqa = getQuestionFromDatastore("qn1InSession1InCourse1"); FeedbackQuestionBundle fqBundle = fqLogic.getFeedbackQuestionBundleForStudent( "First feedback session", "idOfTypicalCourse1", fqa.getId(), "student1InCourse1@gmail.com"); assertEquals(fqBundle.feedbackSession.courseId,"idOfTypicalCourse1"); assertEquals(fqBundle.feedbackSession.feedbackSessionName,"First feedback session"); assertEquals(fqBundle.question.questionNumber, 1); assertEquals(fqBundle.recipientList.size(), 1); assertEquals(fqBundle.responseList.size(), 1); ______TS("non-existent feedback session"); try { fqBundle = fqLogic.getFeedbackQuestionBundleForStudent( "non-existent feedback session", "idOfTypicalCourse1", fqa.getId(), "student1InCourse1@gmail.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.getFeedbackQuestionBundleForStudent( "First feedback session", "idOfTypicalCourse1", "non-existent fq id", "student1InCourse1@gmail.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("qn3InSession1InCourse1"); try { fqBundle = fqLogic.getFeedbackQuestionBundleForStudent( "First feedback session", "idOfTypicalCourse1", fqa.getId(), "student1InCourse1@gmail.com"); signalFailureToDetectException(); } catch (UnauthorizedAccessException e) { assertEquals(e.getMessage(),"Trying to access a question not meant for the user."); } }