MucRoom { public boolean removeUser(KixmppJid address) { KixmppJid bareJid = address.withoutResource(); String nickname = nicknamesByBareJid.get(bareJid); if (nickname == null) { return false; } User user = usersByNickname.get(nickname); if (user == null) { return false; } user.removeClients(); removeDisconnectedUser(user); return true; } 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);  }
@Test public void removeUser_userNotInRoom(){ KixmppJid roomJid = new KixmppJid("testnode", "testdomain"); MucRoom mucRoom = new MucRoom((MucService)Mockito.when(Mockito.mock(MucService.class).getServer()).thenReturn(Mockito.mock(KixmppServer.class)).getMock(), roomJid, new MucRoomSettings(false, false, null)); Assert.assertFalse(mucRoom.removeUser(new KixmppJid("test.user","testdomain"))); }