Program: 9884
Project: 9884
Buggy source:
public void testPersistOAuthProviderUsernames() throws Exception {
  User user1=new UserImpl("String_Node_Str");
  User user2=new UserImpl("String_Node_Str");
  orgService.getUserHandler().createUser(user1,false);
  orgService.getUserHandler().createUser(user2,false);
  UserProfile userProfile1=orgService.getUserProfileHandler().createUserProfileInstance(user1.getUserName());
  userProfile1.setAttribute(OAuthConstants.PROFILE_FACEBOOK_USERNAME,"String_Node_Str");
  userProfile1.setAttribute(OAuthConstants.PROFILE_GOOGLE_USERNAME,"String_Node_Str");
  orgService.getUserProfileHandler().saveUserProfile(userProfile1,true);
  UserProfile userProfile2=orgService.getUserProfileHandler().createUserProfileInstance(user2.getUserName());
  userProfile2.setAttribute(OAuthConstants.PROFILE_FACEBOOK_USERNAME,"String_Node_Str");
  userProfile2.setAttribute(OAuthConstants.PROFILE_GOOGLE_USERNAME,"String_Node_Str");
  orgService.getUserProfileHandler().saveUserProfile(userProfile2,true);
  User foundUser=socialNetworkService.findUserByOAuthProviderUsername(getFacebookProvider(),"String_Node_Str");
  assertNotNull(foundUser);
  assertEquals(foundUser.getUserName(),user1.getUserName());
  User foundUser2=socialNetworkService.findUserByOAuthProviderUsername(getFacebookProvider(),"String_Node_Str");
  assertNotNull(foundUser2);
  assertEquals(foundUser2.getUserName(),user2.getUserName());
  User foundUser3=socialNetworkService.findUserByOAuthProviderUsername(getGoogleProvider(),"String_Node_Str");
  assertNotNull(foundUser3);
  assertEquals(foundUser3.getUserName(),user2.getUserName());
  socialNetworkService.updateOAuthInfo(getFacebookProvider(),user1.getUserName(),"String_Node_Str",createFacebookAccessToken("String_Node_Str"));
  User foundUser4=socialNetworkService.findUserByOAuthProviderUsername(getFacebookProvider(),"String_Node_Str");
  assertNotNull(foundUser4);
  assertEquals(foundUser4.getUserName(),user1.getUserName());
  try {
    socialNetworkService.updateOAuthInfo(getFacebookProvider(),user2.getUserName(),"String_Node_Str",createFacebookAccessToken("String_Node_Str"));
    fail("String_Node_Str");
  }
 catch (  OAuthException gtnOauthOAuthException) {
    assertEquals(OAuthExceptionCode.DUPLICATE_OAUTH_PROVIDER_USERNAME,gtnOauthOAuthException.getExceptionCode());
    assertEquals(OAuthConstants.PROFILE_FACEBOOK_USERNAME,gtnOauthOAuthException.getExceptionAttribute(OAuthConstants.EXCEPTION_OAUTH_PROVIDER_USERNAME_ATTRIBUTE_NAME));
    assertEquals("String_Node_Str",gtnOauthOAuthException.getExceptionAttribute(OAuthConstants.EXCEPTION_OAUTH_PROVIDER_USERNAME));
  }
catch (  Exception e) {
    throw new UndeclaredThrowableException(e);
  }
}

Fixed version (ground truth):
public void testPersistOAuthProviderUsernames() throws Exception {
  User user1=new UserImpl("String_Node_Str");
  User user2=new UserImpl("String_Node_Str");
  orgService.getUserHandler().createUser(user1,false);
  orgService.getUserHandler().createUser(user2,false);
  UserProfile userProfile1=orgService.getUserProfileHandler().createUserProfileInstance(user1.getUserName());
  userProfile1.setAttribute(OAuthConstants.PROFILE_FACEBOOK_USERNAME,"String_Node_Str");
  userProfile1.setAttribute(OAuthConstants.PROFILE_GOOGLE_USERNAME,"String_Node_Str");
  orgService.getUserProfileHandler().saveUserProfile(userProfile1,true);
  UserProfile userProfile2=orgService.getUserProfileHandler().createUserProfileInstance(user2.getUserName());
  userProfile2.setAttribute(OAuthConstants.PROFILE_FACEBOOK_USERNAME,"String_Node_Str");
  userProfile2.setAttribute(OAuthConstants.PROFILE_GOOGLE_USERNAME,"String_Node_Str");
  orgService.getUserProfileHandler().saveUserProfile(userProfile2,true);
  User foundUser=socialNetworkService.findUserByOAuthProviderUsername(getFacebookProvider(),"String_Node_Str");
  assertNotNull(foundUser);
  assertEquals(foundUser.getUserName(),user1.getUserName());
  User foundUser2=socialNetworkService.findUserByOAuthProviderUsername(getFacebookProvider(),"String_Node_Str");
  assertNotNull(foundUser2);
  assertEquals(foundUser2.getUserName(),user2.getUserName());
  User foundUser3=socialNetworkService.findUserByOAuthProviderUsername(getGoogleProvider(),"String_Node_Str");
  assertNotNull(foundUser3);
  assertEquals(foundUser3.getUserName(),user2.getUserName());
  socialNetworkService.updateOAuthInfo(getFacebookProvider(),user1.getUserName(),"String_Node_Str",createFacebookAccessToken("String_Node_Str"));
  User foundUser4=socialNetworkService.findUserByOAuthProviderUsername(getFacebookProvider(),"String_Node_Str");
  assertNotNull(foundUser4);
  assertEquals(foundUser4.getUserName(),user1.getUserName());
  try {
    socialNetworkService.updateOAuthInfo(getFacebookProvider(),user2.getUserName(),"String_Node_Str",createFacebookAccessToken("String_Node_Str"));
    fail("String_Node_Str");
  }
 catch (  OAuthException gtnOauthOAuthException) {
    assertEquals(OAuthExceptionCode.DUPLICATE_OAUTH_PROVIDER_USERNAME,gtnOauthOAuthException.getExceptionCode());
    assertEquals(OAuthConstants.PROFILE_FACEBOOK_USERNAME,gtnOauthOAuthException.getExceptionAttribute(OAuthConstants.EXCEPTION_OAUTH_PROVIDER_USERNAME_ATTRIBUTE_NAME));
    assertEquals("String_Node_Str",gtnOauthOAuthException.getExceptionAttribute(OAuthConstants.EXCEPTION_OAUTH_PROVIDER_USERNAME));
  }
catch (  Exception e) {
    throw new UndeclaredThrowableException(e);
  }
  orgService.getUserHandler().removeUser(user1.getUserName(),false);
  orgService.getUserHandler().removeUser(user2.getUserName(),false);
}