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());
}
};
assertEquals("User name in Roster should have changed", "Some new name", roster.getEntry(FRED).getName());
// Delete user:
myUserModel.removeUser(user);
new WaitFor(TIMEOUT) {
@Override
protected boolean condition() {
return roster.getEntryCount() == 0;
}
};