Program: 62907
Project: 62907
Buggy source:
@Test public void testExecuteAndPostProcess() throws Exception {
  InstructorsDb instrDb=new InstructorsDb();
  InstructorAttributes instructor=dataBundle.instructors.get("String_Node_Str");
  instructor=instrDb.getInstructorForEmail(instructor.courseId,instructor.email);
  gaeSimulation.loginAsInstructor(instructor.googleId);
  ______TS("String_Node_Str");
  String[] submissionParams=new String[]{Const.ParamsNames.REGKEY,"String_Node_Str"};
  InstructorCourseJoinAuthenticatedAction a=getAction(submissionParams);
  RedirectResult r=(RedirectResult)a.executeAndPostProcess();
  assertEquals(Const.ActionURIs.INSTRUCTOR_HOME_PAGE + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ instructor.googleId,r.getDestinationWithParams());
  assertTrue(r.isError);
  ______TS("String_Node_Str");
  submissionParams=new String[]{Const.ParamsNames.REGKEY,StringHelper.encrypt(instructor.key)};
  a=getAction(submissionParams);
  r=(RedirectResult)a.executeAndPostProcess();
  assertEquals(Const.ActionURIs.INSTRUCTOR_HOME_PAGE + "String_Node_Str" + "String_Node_Str"+ instructor.courseId+ "String_Node_Str"+ instructor.googleId,r.getDestinationWithParams());
  assertTrue(r.isError);
  ______TS("String_Node_Str");
  InstructorAttributes instructor2=dataBundle.instructors.get("String_Node_Str");
  instructor2=instrDb.getInstructorForGoogleId(instructor2.courseId,instructor2.googleId);
  submissionParams=new String[]{Const.ParamsNames.REGKEY,StringHelper.encrypt(instructor2.key)};
  a=getAction(submissionParams);
  r=(RedirectResult)a.executeAndPostProcess();
  assertEquals(Const.ActionURIs.INSTRUCTOR_HOME_PAGE + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ instructor2.courseId+ "String_Node_Str"+ instructor.googleId,r.getDestinationWithParams());
  assertTrue(r.isError);
  ______TS("String_Node_Str");
  instructor=new InstructorAttributes("String_Node_Str",instructor.courseId,"String_Node_Str","String_Node_Str");
  InstructorsLogic.inst().addInstructor(instructor.courseId,instructor.name,instructor.email);
  AccountAttributes newInstructorAccount=new AccountAttributes(instructor.googleId,instructor.name,false,instructor.email,"String_Node_Str");
  AccountsLogic.inst().createAccount(newInstructorAccount);
  InstructorAttributes newInstructor=instrDb.getInstructorForEmail(instructor.courseId,instructor.email);
  gaeSimulation.loginUser(instructor.googleId);
  submissionParams=new String[]{Const.ParamsNames.REGKEY,StringHelper.encrypt(newInstructor.key)};
  a=getAction(submissionParams);
  r=(RedirectResult)a.executeAndPostProcess();
  assertEquals(Const.ActionURIs.INSTRUCTOR_HOME_PAGE + "String_Node_Str" + "String_Node_Str",r.getDestinationWithParams());
  assertFalse(r.isError);
  InstructorAttributes retrievedInstructor=instrDb.getInstructorForEmail(instructor.courseId,instructor.email);
  assertEquals(instructor.googleId,retrievedInstructor.googleId);
}

Fixed version (ground truth):
@Test public void testExecuteAndPostProcess() throws Exception {
  InstructorAttributes instructor=dataBundle.instructors.get("String_Node_Str");
  InstructorsDb instrDb=new InstructorsDb();
  instructor=instrDb.getInstructorForEmail(instructor.courseId,instructor.email);
  gaeSimulation.loginAsInstructor(instructor.googleId);
  ______TS("String_Node_Str");
  String[] submissionParams=new String[]{Const.ParamsNames.REGKEY,invalidEncryptedKey};
  InstructorCourseJoinAuthenticatedAction joinAction=getAction(submissionParams);
  RedirectResult redirectResult=(RedirectResult)joinAction.executeAndPostProcess();
  assertEquals(Const.ActionURIs.INSTRUCTOR_HOME_PAGE + "String_Node_Str" + "String_Node_Str"+ invalidEncryptedKey+ "String_Node_Str"+ instructor.googleId,redirectResult.getDestinationWithParams());
  assertTrue(redirectResult.isError);
  assertEquals("String_Node_Str" + Const.ActionURIs.INSTRUCTOR_COURSE_JOIN + "String_Node_Str"+ invalidEncryptedKey,redirectResult.getStatusMessage());
  String expectedLogSegment="String_Node_Str" + Const.ActionURIs.INSTRUCTOR_COURSE_JOIN + "String_Node_Str"+ invalidEncryptedKey+ "String_Node_Str"+ "String_Node_Str";
  AssertHelper.assertContains(expectedLogSegment,joinAction.getLogMessage());
  ______TS("String_Node_Str");
  submissionParams=new String[]{Const.ParamsNames.REGKEY,StringHelper.encrypt(instructor.key)};
  joinAction=getAction(submissionParams);
  redirectResult=(RedirectResult)joinAction.executeAndPostProcess();
  assertEquals(Const.ActionURIs.INSTRUCTOR_HOME_PAGE + "String_Node_Str" + "String_Node_Str"+ instructor.courseId+ "String_Node_Str"+ instructor.googleId,redirectResult.getDestinationWithParams());
  assertTrue(redirectResult.isError);
  assertEquals(instructor.googleId + "String_Node_Str",redirectResult.getStatusMessage());
  expectedLogSegment="String_Node_Str" + instructor.googleId + "String_Node_Str"+ "String_Node_Str"+ instructor.googleId+ "String_Node_Str"+ instructor.key;
  AssertHelper.assertContains(expectedLogSegment,joinAction.getLogMessage());
  ______TS("String_Node_Str");
  InstructorAttributes instructor2=dataBundle.instructors.get("String_Node_Str");
  instructor2=instrDb.getInstructorForGoogleId(instructor2.courseId,instructor2.googleId);
  submissionParams=new String[]{Const.ParamsNames.REGKEY,StringHelper.encrypt(instructor2.key)};
  joinAction=getAction(submissionParams);
  redirectResult=(RedirectResult)joinAction.executeAndPostProcess();
  assertEquals(Const.ActionURIs.INSTRUCTOR_HOME_PAGE + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ instructor2.courseId+ "String_Node_Str"+ instructor.googleId,redirectResult.getDestinationWithParams());
  assertTrue(redirectResult.isError);
  AssertHelper.assertContains("String_Node_Str",redirectResult.getStatusMessage());
  expectedLogSegment="String_Node_Str";
  AssertHelper.assertContains(expectedLogSegment,joinAction.getLogMessage());
  ______TS("String_Node_Str");
  instructor=new InstructorAttributes("String_Node_Str",instructor.courseId,"String_Node_Str","String_Node_Str");
  InstructorsLogic.inst().addInstructor(instructor.courseId,instructor.name,instructor.email);
  AccountAttributes newInstructorAccount=new AccountAttributes(instructor.googleId,instructor.name,false,instructor.email,"String_Node_Str");
  AccountsLogic.inst().createAccount(newInstructorAccount);
  InstructorAttributes newInstructor=instrDb.getInstructorForEmail(instructor.courseId,instructor.email);
  gaeSimulation.loginUser(instructor.googleId);
  submissionParams=new String[]{Const.ParamsNames.REGKEY,StringHelper.encrypt(newInstructor.key)};
  joinAction=getAction(submissionParams);
  redirectResult=(RedirectResult)joinAction.executeAndPostProcess();
  assertEquals(Const.ActionURIs.INSTRUCTOR_HOME_PAGE + "String_Node_Str" + "String_Node_Str",redirectResult.getDestinationWithParams());
  assertFalse(redirectResult.isError);
  assertEquals("String_Node_Str",redirectResult.getStatusMessage());
  InstructorAttributes retrievedInstructor=instrDb.getInstructorForEmail(instructor.courseId,instructor.email);
  assertEquals(instructor.googleId,retrievedInstructor.googleId);
  expectedLogSegment="String_Node_Str" + instructor.googleId + "String_Node_Str"+ newInstructor.key;
  AssertHelper.assertContains(expectedLogSegment,joinAction.getLogMessage());
}