Program: 62701
Project: 62701
Buggy source:
@Test public void testSaveAndUpdateFeedbackParticipantCommentsOnResponse(){
  FeedbackQuestionsDb fqDb=new FeedbackQuestionsDb();
  FeedbackResponsesDb frDb=new FeedbackResponsesDb();
  DataBundle dataBundle=loadDataBundle("String_Node_Str");
  removeAndRestoreDataBundle(dataBundle);
  FeedbackQuestionAttributes fq=fqDb.getFeedbackQuestion("String_Node_Str","String_Node_Str",1);
  assertNotNull("String_Node_Str",fq);
  FeedbackResponseAttributes fr=dataBundle.feedbackResponses.get("String_Node_Str");
  fr=frDb.getFeedbackResponse(fq.getId(),fr.giver,fr.recipient);
  assertNotNull("String_Node_Str",fr);
  StudentAttributes student1InCourse1=dataBundle.students.get("String_Node_Str");
  gaeSimulation.loginAsStudent(student1InCourse1.googleId);
  ______TS("String_Node_Str");
  String[] submissionParams=new String[]{Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "String_Node_Str","String_Node_Str",Const.ParamsNames.FEEDBACK_RESPONSE_ID + "String_Node_Str",fr.getId(),Const.ParamsNames.FEEDBACK_SESSION_NAME,fr.feedbackSessionName,Const.ParamsNames.COURSE_ID,fr.courseId,Const.ParamsNames.FEEDBACK_QUESTION_ID + "String_Node_Str",fr.feedbackQuestionId,Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "String_Node_Str",fr.recipient,Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "String_Node_Str",fr.feedbackQuestionType.toString(),Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "String_Node_Str","String_Node_Str",Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ADD_TEXT + "String_Node_Str","String_Node_Str"};
  RedirectResult result=getRedirectResult(getAction(submissionParams));
  assertFalse(result.isError);
  assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED,result.getStatusMessage());
  assertEquals(getPageResultDestination(Const.ActionURIs.STUDENT_FEEDBACK_SUBMISSION_EDIT_PAGE,result.isError,"String_Node_Str","String_Node_Str","String_Node_Str"),result.getDestinationWithParams());
  FeedbackResponseCommentAttributes frc=getFeedbackParticipantComment(fr.getId());
  assertEquals("String_Node_Str",frc.commentText.getValue());
  assertEquals(FeedbackParticipantType.STUDENTS,frc.commentGiverType);
  assertEquals("String_Node_Str",frc.commentGiver);
  assertTrue(frc.isCommentFromFeedbackParticipant);
  assertTrue(frc.isVisibilityFollowingFeedbackQuestion);
  ______TS("String_Node_Str");
  submissionParams=new String[]{Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "String_Node_Str","String_Node_Str",Const.ParamsNames.FEEDBACK_RESPONSE_ID + "String_Node_Str",fr.getId(),Const.ParamsNames.FEEDBACK_SESSION_NAME,fr.feedbackSessionName,Const.ParamsNames.COURSE_ID,fr.courseId,Const.ParamsNames.FEEDBACK_QUESTION_ID + "String_Node_Str",fr.feedbackQuestionId,Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "String_Node_Str",fr.recipient,Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "String_Node_Str",fr.feedbackQuestionType.toString(),Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "String_Node_Str","String_Node_Str",Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT + "String_Node_Str","String_Node_Str",Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID + "String_Node_Str",frc.getId().toString()};
  result=getRedirectResult(getAction(submissionParams));
  assertFalse(result.isError);
  assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED,result.getStatusMessage());
  assertEquals(getPageResultDestination(Const.ActionURIs.STUDENT_FEEDBACK_SUBMISSION_EDIT_PAGE,result.isError,"String_Node_Str","String_Node_Str","String_Node_Str"),result.getDestinationWithParams());
  frc=getFeedbackParticipantComment(fr.getId());
  assertEquals("String_Node_Str",frc.commentText.getValue());
  assertEquals(FeedbackParticipantType.STUDENTS,frc.commentGiverType);
  assertEquals("String_Node_Str",frc.commentGiver);
  assertTrue(frc.isCommentFromFeedbackParticipant);
  assertTrue(frc.isVisibilityFollowingFeedbackQuestion);
  ______TS("String_Node_Str");
  dataBundle=getTypicalDataBundle();
  removeAndRestoreDataBundle(dataBundle);
  fq=fqDb.getFeedbackQuestion("String_Node_Str","String_Node_Str",1);
  assertNotNull("String_Node_Str",fq);
  fr=typicalBundle.feedbackResponses.get("String_Node_Str");
  fr=frDb.getFeedbackResponse(fq.getId(),fr.giver,fr.recipient);
  assertNotNull("String_Node_Str",fr);
  student1InCourse1=typicalBundle.students.get("String_Node_Str");
  gaeSimulation.loginAsStudent(student1InCourse1.googleId);
  submissionParams=new String[]{Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "String_Node_Str","String_Node_Str",Const.ParamsNames.FEEDBACK_RESPONSE_ID + "String_Node_Str",fr.getId(),Const.ParamsNames.FEEDBACK_SESSION_NAME,fr.feedbackSessionName,Const.ParamsNames.COURSE_ID,fr.courseId,Const.ParamsNames.FEEDBACK_QUESTION_ID + "String_Node_Str",fr.feedbackQuestionId,Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "String_Node_Str",fr.recipient,Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "String_Node_Str",fr.feedbackQuestionType.toString(),Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "String_Node_Str","String_Node_Str" + fr.getResponseDetails().getAnswerString(),Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ADD_TEXT + "String_Node_Str","String_Node_Str"};
  result=getRedirectResult(getAction(submissionParams));
  assertFalse(result.isError);
  assertNull(getFeedbackParticipantComment(fr.getId()));
}

Fixed version (ground truth):
@Test public void testSaveAndUpdateFeedbackParticipantCommentsOnResponse(){
  FeedbackQuestionsDb fqDb=new FeedbackQuestionsDb();
  FeedbackResponsesDb frDb=new FeedbackResponsesDb();
  FeedbackResponseCommentsDb frcDb=new FeedbackResponseCommentsDb();
  DataBundle dataBundle=loadDataBundle("String_Node_Str");
  removeAndRestoreDataBundle(dataBundle);
  FeedbackQuestionAttributes fq=fqDb.getFeedbackQuestion("String_Node_Str","String_Node_Str",1);
  assertNotNull("String_Node_Str",fq);
  FeedbackResponseAttributes fr=dataBundle.feedbackResponses.get("String_Node_Str");
  fr=frDb.getFeedbackResponse(fq.getId(),fr.giver,fr.recipient);
  assertNotNull("String_Node_Str",fr);
  StudentAttributes student1InCourse1=dataBundle.students.get("String_Node_Str");
  gaeSimulation.loginAsStudent(student1InCourse1.googleId);
  ______TS("String_Node_Str");
  String[] submissionParams=new String[]{Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "String_Node_Str","String_Node_Str",Const.ParamsNames.FEEDBACK_RESPONSE_ID + "String_Node_Str",fr.getId(),Const.ParamsNames.FEEDBACK_SESSION_NAME,fr.feedbackSessionName,Const.ParamsNames.COURSE_ID,fr.courseId,Const.ParamsNames.FEEDBACK_QUESTION_ID + "String_Node_Str",fr.feedbackQuestionId,Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "String_Node_Str",fr.recipient,Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "String_Node_Str",fr.feedbackQuestionType.toString(),Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "String_Node_Str","String_Node_Str",Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ADD_TEXT + "String_Node_Str","String_Node_Str"};
  RedirectResult result=getRedirectResult(getAction(submissionParams));
  assertFalse(result.isError);
  assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED,result.getStatusMessage());
  assertEquals(getPageResultDestination(Const.ActionURIs.STUDENT_FEEDBACK_SUBMISSION_EDIT_PAGE,result.isError,"String_Node_Str","String_Node_Str","String_Node_Str"),result.getDestinationWithParams());
  FeedbackResponseCommentAttributes frc=getFeedbackParticipantComment(fr.getId());
  assertEquals("String_Node_Str",frc.commentText.getValue());
  assertEquals(FeedbackParticipantType.STUDENTS,frc.commentGiverType);
  assertEquals("String_Node_Str",frc.commentGiver);
  assertTrue(frc.isCommentFromFeedbackParticipant);
  assertTrue(frc.isVisibilityFollowingFeedbackQuestion);
  ArrayList<InstructorAttributes> instructors=new ArrayList<>();
  instructors.add(dataBundle.instructors.get("String_Node_Str"));
  FeedbackResponseCommentSearchResultBundle bundle=frcDb.search("String_Node_Str",instructors);
  assertEquals(1,bundle.numberOfResults);
  verifySearchResults(bundle,frc);
  ______TS("String_Node_Str");
  submissionParams=new String[]{Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "String_Node_Str","String_Node_Str",Const.ParamsNames.FEEDBACK_RESPONSE_ID + "String_Node_Str",fr.getId(),Const.ParamsNames.FEEDBACK_SESSION_NAME,fr.feedbackSessionName,Const.ParamsNames.COURSE_ID,fr.courseId,Const.ParamsNames.FEEDBACK_QUESTION_ID + "String_Node_Str",fr.feedbackQuestionId,Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "String_Node_Str",fr.recipient,Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "String_Node_Str",fr.feedbackQuestionType.toString(),Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "String_Node_Str","String_Node_Str",Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT + "String_Node_Str","String_Node_Str",Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID + "String_Node_Str",frc.getId().toString()};
  result=getRedirectResult(getAction(submissionParams));
  assertFalse(result.isError);
  assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED,result.getStatusMessage());
  assertEquals(getPageResultDestination(Const.ActionURIs.STUDENT_FEEDBACK_SUBMISSION_EDIT_PAGE,result.isError,"String_Node_Str","String_Node_Str","String_Node_Str"),result.getDestinationWithParams());
  frc=getFeedbackParticipantComment(fr.getId());
  assertEquals("String_Node_Str",frc.commentText.getValue());
  assertEquals(FeedbackParticipantType.STUDENTS,frc.commentGiverType);
  assertEquals("String_Node_Str",frc.commentGiver);
  assertTrue(frc.isCommentFromFeedbackParticipant);
  assertTrue(frc.isVisibilityFollowingFeedbackQuestion);
  bundle=frcDb.search("String_Node_Str",instructors);
  assertEquals(1,bundle.numberOfResults);
  verifySearchResults(bundle,frc);
  ______TS("String_Node_Str");
  dataBundle=getTypicalDataBundle();
  removeAndRestoreDataBundle(dataBundle);
  fq=fqDb.getFeedbackQuestion("String_Node_Str","String_Node_Str",1);
  assertNotNull("String_Node_Str",fq);
  fr=typicalBundle.feedbackResponses.get("String_Node_Str");
  fr=frDb.getFeedbackResponse(fq.getId(),fr.giver,fr.recipient);
  assertNotNull("String_Node_Str",fr);
  student1InCourse1=typicalBundle.students.get("String_Node_Str");
  gaeSimulation.loginAsStudent(student1InCourse1.googleId);
  submissionParams=new String[]{Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "String_Node_Str","String_Node_Str",Const.ParamsNames.FEEDBACK_RESPONSE_ID + "String_Node_Str",fr.getId(),Const.ParamsNames.FEEDBACK_SESSION_NAME,fr.feedbackSessionName,Const.ParamsNames.COURSE_ID,fr.courseId,Const.ParamsNames.FEEDBACK_QUESTION_ID + "String_Node_Str",fr.feedbackQuestionId,Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "String_Node_Str",fr.recipient,Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "String_Node_Str",fr.feedbackQuestionType.toString(),Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "String_Node_Str","String_Node_Str" + fr.getResponseDetails().getAnswerString(),Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ADD_TEXT + "String_Node_Str","String_Node_Str"};
  result=getRedirectResult(getAction(submissionParams));
  assertFalse(result.isError);
  assertNull(getFeedbackParticipantComment(fr.getId()));
}