final RoomChat room = manager.open(uri("room1@domain/nick"));
session.receives("<presence to='user@domain/resource' xmlns='jabber:client' from='room1@domain/otherUser'>"
+ "<x xmlns='http://jabber.org/protocol/muc#user'>" + "<item role='moderator' affiliation='owner' jid='otherUser@domain' /></x></presence>");
assertEquals(1, room.getOccupantsCount());
Occupant user = room.getOccupantByOccupantUri(uri("room1@domain/otherUser"));
assertNotNull(user);
assertEquals(Affiliation.owner, user.getAffiliation());
assertEquals(Role.moderator, user.getRole());
session.receives("<presence to='user@domain/resource' xmlns='jabber:client' from='room1@domain/otherUser'>"
+ "<x xmlns='http://jabber.org/protocol/muc#user'>" + "<item role='participant' affiliation='member' /></x></presence>");
assertEquals(1, room.getOccupantsCount());
user = room.getOccupantByOccupantUri(uri("room1@domain/otherUser"));
assertNotNull(user);
assertEquals(Affiliation.member, user.getAffiliation());
assertEquals(Role.participant, user.getRole());
session.receives("<presence to='user@domain/res1' type='unavailable' " + "xmlns='jabber:client' from='room1@domain/otherUser'>"
+ "<status>custom message</status><x xmlns='http://jabber.org/protocol/muc#user'>" + "<item role='none' affiliation='member' /></x></presence>");
assertEquals(0, room.getOccupantsCount());