test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetMultiUserChat2.java
/**
     * user1 send to user2 an invitation which will be rejected.
     */
user1 send to user2 an invitation which will be rejected.
user1 send to user2 an invitation which will be rejected .
public void testInviteReject()
        throws OperationFailedException,
               OperationNotSupportedException, XmppStringprepException
    {
        MUCEventCollector opSet1Collector =
            new MUCEventCollector(opSetMUC1, MUCEventCollector.EVENT_INVITE);
        MUCEventCollector opSet2Collector =
            new MUCEventCollector(opSetMUC2, MUCEventCollector.EVENT_INVITE);
        String testRoomName = testRoomBaseName + roomID++;
        ChatRoom opSet1Room =
            opSetMUC1.createChatRoom(testRoomName, null);
        opSet1Room.join();
        opSet1Room.invite(fixture.userID2, "testInviteReject");
        opSet2Collector.waitForEvent(10000);
        assertEquals(
            "The invitation sent from user1 to user2 has not been received "
            , 1, opSet2Collector.collectedEvents.size());
        ChatRoomInvitationReceivedEvent invitationReceivedEvent =
            (ChatRoomInvitationReceivedEvent)
            opSet2Collector.collectedEvents.get(0);
        ChatRoomInvitation invitation = invitationReceivedEvent.getInvitation();
        assertEquals("The inviter is not the expected user",
            JidCreate.bareFrom(fixture.userID1),
            JidCreate.bareFrom(invitation.getInviter()));
        assertEquals("The invitation reason received differs from the one sent"
            , "testInviteReject", invitation.getReason());
        opSetMUC2.rejectInvitation(invitation, invitation.getReason());
        opSet1Collector.waitForEvent(10000);
        assertEquals(
            "no response received from the invitation sent to user 2"
            , 1, opSet1Collector.collectedEvents.size());
        ChatRoomInvitationRejectedEvent invitationRejectedEvent =
            (ChatRoomInvitationRejectedEvent)
            opSet1Collector.collectedEvents.get(0);
        assertEquals("the invitation has been declined  by an unexpected user",
            JidCreate.bareFrom(fixture.userID2),
            JidCreate.bareFrom(invitationRejectedEvent.getInvitee()));
        assertEquals("the invitation is not declined for the expected reason",
            "testInviteReject", invitationRejectedEvent.getReason());
    }
public void testInviteReject ( ) throws OperationFailedException , OperationNotSupportedException , XmppStringprepException { MUCEventCollector opSet1Collector = new MUCEventCollector ( opSetMUC1 , MUCEventCollector . EVENT_INVITE ) ; MUCEventCollector opSet2Collector = new MUCEventCollector ( opSetMUC2 , MUCEventCollector . EVENT_INVITE ) ; String testRoomName = testRoomBaseName + roomID ++ ; ChatRoom opSet1Room = opSetMUC1 . createChatRoom ( testRoomName , null ) ; opSet1Room . join ( ) ; opSet1Room . invite ( fixture . userID2 , "testInviteReject" ) ; opSet2Collector . waitForEvent ( 10000 ) ; assertEquals ( "The invitation sent from user1 to user2 has not been received " , 1 , opSet2Collector . collectedEvents . size ( ) ) ; ChatRoomInvitationReceivedEvent invitationReceivedEvent = ( ChatRoomInvitationReceivedEvent ) opSet2Collector . collectedEvents . get ( 0 ) ; ChatRoomInvitation invitation = invitationReceivedEvent . getInvitation ( ) ; assertEquals ( "The inviter is not the expected user" , JidCreate . bareFrom ( fixture . userID1 ) , JidCreate . bareFrom ( invitation . getInviter ( ) ) ) ; assertEquals ( "The invitation reason received differs from the one sent" , "testInviteReject" , invitation . getReason ( ) ) ; opSetMUC2 . rejectInvitation ( invitation , invitation . getReason ( ) ) ; opSet1Collector . waitForEvent ( 10000 ) ; assertEquals ( "no response received from the invitation sent to user 2" , 1 , opSet1Collector . collectedEvents . size ( ) ) ; ChatRoomInvitationRejectedEvent invitationRejectedEvent = ( ChatRoomInvitationRejectedEvent ) opSet1Collector . collectedEvents . get ( 0 ) ; assertEquals ( "the invitation has been declined  by an unexpected user" , JidCreate . bareFrom ( fixture . userID2 ) , JidCreate . bareFrom ( invitationRejectedEvent . getInvitee ( ) ) ) ; assertEquals ( "the invitation is not declined for the expected reason" , "testInviteReject" , invitationRejectedEvent . getReason ( ) ) ; }
user1 send to user2 an invitation which will be rejected.
user1 send to user2 an invitation which will be rejected .
// we create the test room // an invitation user2 must reject //now we look if user2 received an event // does the invitation comes from user1 with the correct reason //user2 reject the invitation as planned //is user1 aware his invitation has been declined //who declined the invitation and why