@Test public void shouldAcceptInvitations() { ChatChangedTestHandler handler = new ChatChangedTestHandler(); ChatProperties properties = new ChatProperties(USER); manager.addChatChangedHandler(handler); RoomInvitation invitation = new RoomInvitation( uri("friend@host/resource"), uri("*****@*****.**"), "theReason", properties); manager.acceptRoomInvitation(invitation); assertEquals(2, handler.getCalledTimes()); assertEquals(ChangeTypes.created, handler.getEvent(0).getChangeType()); assertEquals(ChangeTypes.opened, handler.getEvent(1).getChangeType()); }
@Test public void shouldCreateInstantRoomIfNeeded() { manager.open(uri("[email protected]/nick")); session.receives( "<presence from='[email protected]/nick' to='user@localhost/resource' >" + "<priority>5</priority>" + "<x xmlns='http://jabber.org/protocol/muc#user'>" + "<item affiliation='owner' role='moderator' jid='vjrj@localhost/Psi' />" + "<status code='201' />" + "</x>" + "</presence>"); session.verifyIQSent(new IQ(Type.set)); }