public void testLocalChanges_UpdateRoster() throws Throwable {
addEventListener();
addUserFred();
User user = myUserModel.getAllUsers()[0];
final Roster roster = myFacade.getConnection().getRoster();
// Change group:
user.setGroup("someOtherGroup", myUserModel);
new WaitFor(TIMEOUT) {
@Override
protected boolean condition() {
return roster.getGroupCount() == 1 && roster.getGroup("someOtherGroup") != null;
}
};
assertEquals("One group expected", 1, roster.getGroupCount());
RosterGroup group = roster.getGroup("someOtherGroup");
assertNotNull(group);
assertEquals(1, group.getEntryCount());
assertNotNull(group.getEntry(FRED));
// Change Display name:
user.setDisplayName("Some new name", myUserModel);
new WaitFor(TIMEOUT) {
@Override
protected boolean condition() {
return "Some new name".equals(roster.getEntry(FRED).getName());
}