@Test(expected = RoomJoinNotAllowedException.class) public void joinRoom_firstTime_isNotOpen_noMemberAdded() { KixmppServer server = (KixmppServer)Mockito.when(Mockito.mock(KixmppServer.class).getEventEngine()) .thenReturn(new KixmppEventEngine()).getMock(); MucService mucService = (MucService)Mockito.when(Mockito.mock(MucService.class).getServer()) .thenReturn(server).getMock(); KixmppJid roomJid = new KixmppJid("testnode", "testdomain"); MucRoom mucRoom = new MucRoom(mucService, roomJid, new MucRoomSettings(false, false, null)); Channel channel = Mockito.mock(Channel.class); Attribute<KixmppJid> jidAttribute = Mockito.mock(Attribute.class); Mockito.when(jidAttribute.get()).thenReturn(new KixmppJid("test.user", "testdomain", "testresource")); Mockito.when(channel.attr(BindKixmppServerModule.JID)).thenReturn(jidAttribute); Mockito.when(channel.closeFuture()).thenReturn(Mockito.mock(ChannelFuture.class)); mucRoom.join(channel, "nickname"); }
public void join(Channel channel, String nickname) { join(channel, nickname, null); }
MucRoom { public void join(Channel channel, String nickname) { join(channel, nickname, null); } }
MucRoom { public void join(Channel channel, String nickname) { join(channel, nickname, null); } MucRoom(MucService service, KixmppJid roomJid, MucRoomSettings settings); }
MucRoom { public void join(Channel channel, String nickname) { join(channel, nickname, null); } MucRoom(MucService service, KixmppJid roomJid, MucRoomSettings settings); KixmppJid getRoomJid(); void addUser(KixmppJid jid, String nickname, MucRole role, MucAffiliation affiliation); void join(Channel channel, String nickname); void join(final Channel channel, String nickname, Element mucStanza); void receivePresence(KixmppJid fromRoomJid, MucRole role, String type); boolean removeUser(KixmppJid address); boolean userLeft(Channel channel, String nickname); void receiveMessages(KixmppJid fromAddress, boolean sendToCluster, String... messages); void receive(KixmppJid fromJid, KixmppJid fromRoomJid, String... messages); void sendDirectInvite(KixmppJid from, Channel userChannelToInvite, String reason); void sendMediatedInvite(KixmppJid from, Channel userChannelToInvite, String reason); List<User> getUsers(); User getUser(String nickname); User getUser(KixmppJid jid); }
MucRoom { public void join(Channel channel, String nickname) { join(channel, nickname, null); } MucRoom(MucService service, KixmppJid roomJid, MucRoomSettings settings); KixmppJid getRoomJid(); void addUser(KixmppJid jid, String nickname, MucRole role, MucAffiliation affiliation); void join(Channel channel, String nickname); void join(final Channel channel, String nickname, Element mucStanza); void receivePresence(KixmppJid fromRoomJid, MucRole role, String type); boolean removeUser(KixmppJid address); boolean userLeft(Channel channel, String nickname); void receiveMessages(KixmppJid fromAddress, boolean sendToCluster, String... messages); void receive(KixmppJid fromJid, KixmppJid fromRoomJid, String... messages); void sendDirectInvite(KixmppJid from, Channel userChannelToInvite, String reason); void sendMediatedInvite(KixmppJid from, Channel userChannelToInvite, String reason); List<User> getUsers(); User getUser(String nickname); User getUser(KixmppJid jid);  }