Program: 177768
Project: 177768
Buggy source:
/** 
 * Tests that the listener created in saveUserSettings behaves correctly.
 */
@UsesMocks({SocializeException.class,SocializeSessionPersister.class,NotificationRegistrationSystem.class,User.class,UserSettings.class}) public void testSaveUserProfileListener(){
  final long id=69;
  Context context=new MockContext();
  String firstName="String_Node_Str";
  String lastName="String_Node_Str";
  UserSettings profile=new UserSettings();
  profile.setFirstName(firstName);
  profile.setLastName(lastName);
  profile.setAutoPostFacebook(true);
  profile.setAutoPostTwitter(true);
  profile.setNotificationsEnabled(true);
  profile.setLocationEnabled(true);
  User user=AndroidMock.createMock(User.class);
  UserSettings userSettings=AndroidMock.createMock(UserSettings.class);
  SocializeSessionPersister sessionPersister=AndroidMock.createMock(SocializeSessionPersister.class);
  SocializeException exception=AndroidMock.createMock(SocializeException.class);
  NotificationRegistrationSystem notificationRegistrationSystem=AndroidMock.createMock(NotificationRegistrationSystem.class);
  AndroidMock.expect(session.getUser()).andReturn(user).times(2);
  AndroidMock.expect(session.getUserSettings()).andReturn(userSettings).times(2);
  AndroidMock.expect(user.getId()).andReturn(id);
  AndroidMock.expect(userSettings.isNotificationsEnabled()).andReturn(false);
  notificationRegistrationSystem.registerC2DMAsync(context);
  user.update(user);
  userSettings.update(profile);
  listener.onUpdate(user);
  listener.onError(exception);
  sessionPersister.saveUser(context,user,profile);
  user.setFirstName(firstName);
  user.setLastName(lastName);
  SocializeUserSystem api=new SocializeUserSystem(provider){
    @Override public void putAsPostAsync(    SocializeSession session,    String endpoint,    User object,    SocializeActionListener listener){
      addResult(listener);
    }
  }
;
  api.setSessionPersister(sessionPersister);
  AndroidMock.replay(session,listener,sessionPersister,user,userSettings,notificationRegistrationSystem);
  api.setNotificationRegistrationSystem(notificationRegistrationSystem);
  api.saveUserSettings(context,session,profile,listener);
  UserSaveListener listenerFound=getNextResult();
  assertNotNull(listenerFound);
  listenerFound.onUpdate(user);
  listenerFound.onError(exception);
  AndroidMock.verify(session,listener,sessionPersister,user,userSettings,notificationRegistrationSystem);
}

Fixed version (ground truth):
/** 
 * Tests that the listener created in saveUserSettings behaves correctly.
 */
@UsesMocks({SocializeException.class,SocializeSessionPersister.class,NotificationRegistrationSystem.class,User.class,UserSettings.class}) public void testSaveUserProfileListener(){
  final long id=69;
  Context context=new MockContext();
  String firstName="String_Node_Str";
  String lastName="String_Node_Str";
  UserSettings settingsToBeSaved=new UserSettings();
  settingsToBeSaved.setFirstName(firstName);
  settingsToBeSaved.setLastName(lastName);
  settingsToBeSaved.setAutoPostFacebook(true);
  settingsToBeSaved.setAutoPostTwitter(true);
  settingsToBeSaved.setNotificationsEnabled(true);
  settingsToBeSaved.setLocationEnabled(true);
  UserSettings sessionSettings=new UserSettings();
  sessionSettings.setNotificationsEnabled(false);
  User sessionUser=new User();
  sessionUser.setId(id);
  SocializeSessionPersister sessionPersister=AndroidMock.createMock(SocializeSessionPersister.class);
  SocializeException exception=AndroidMock.createMock(SocializeException.class);
  NotificationRegistrationSystem notificationRegistrationSystem=AndroidMock.createMock(NotificationRegistrationSystem.class);
  AndroidMock.expect(session.getUser()).andReturn(sessionUser).anyTimes();
  AndroidMock.expect(session.getUserSettings()).andReturn(sessionSettings).anyTimes();
  notificationRegistrationSystem.registerC2DMAsync(context);
  listener.onUpdate(sessionUser);
  listener.onError(exception);
  sessionPersister.saveUser(context,sessionUser,sessionSettings);
  SocializeUserSystem api=new SocializeUserSystem(provider){
    @Override public void putAsPostAsync(    SocializeSession session,    String endpoint,    User object,    SocializeActionListener listener){
      addResult(listener);
    }
  }
;
  api.setSessionPersister(sessionPersister);
  AndroidMock.replay(session,listener,sessionPersister,notificationRegistrationSystem);
  api.setNotificationRegistrationSystem(notificationRegistrationSystem);
  api.saveUserSettings(context,session,settingsToBeSaved,listener);
  UserSaveListener listenerFound=getNextResult();
  assertNotNull(listenerFound);
  listenerFound.onUpdate(sessionUser);
  listenerFound.onError(exception);
  AndroidMock.verify(session,listener,sessionPersister,notificationRegistrationSystem);
  Assert.assertEquals(firstName,sessionSettings.getFirstName());
  Assert.assertEquals(lastName,sessionSettings.getLastName());
  Assert.assertEquals(true,sessionSettings.isAutoPostFacebook());
  Assert.assertEquals(true,sessionSettings.isAutoPostTwitter());
  Assert.assertEquals(true,sessionSettings.isNotificationsEnabled());
  Assert.assertEquals(true,sessionSettings.isLocationEnabled());
  Assert.assertEquals(firstName,sessionUser.getFirstName());
  Assert.assertEquals(lastName,sessionUser.getLastName());
}