1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-27 00:32:07 +01:00

Added test for anonymous users joining a room.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2441 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2004-12-31 04:31:12 +00:00 committed by gaston
parent 9cf3d53132
commit 5386c77c7f

View file

@ -234,6 +234,38 @@ public class MultiUserChatTest extends SmackTestCase {
} }
} }
public void testAnonymousParticipant() {
try {
// Anonymous user joins the new room
XMPPConnection anonConnection = new XMPPConnection(getHost(), getPort());
anonConnection.loginAnonymously();
MultiUserChat muc2 = new MultiUserChat(anonConnection, room);
muc2.join("testbot2");
Thread.sleep(400);
// User1 checks the presence of Anonymous user in the room
Presence presence = muc.getOccupantPresence(room + "/testbot2");
assertNotNull("Presence of user2 in room is missing", presence);
assertEquals(
"Presence mode of user2 is wrong",
Presence.Mode.AVAILABLE,
presence.getMode());
// Anonymous user leaves the room
muc2.leave();
anonConnection.close();
Thread.sleep(250);
// User1 checks the presence of Anonymous user in the room
presence = muc.getOccupantPresence(room + "/testbot2");
assertNull("Presence of participant testbotII still exists", presence);
}
catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
public void testInvitation() { public void testInvitation() {
final String[] answer = new String[2]; final String[] answer = new String[2];
try { try {