### Question:
XMPPNotification implements NotificationMethods { void sendMultiUserMessage (Message msg, EntityBareJid jid) throws InterruptedException, IOException, SmackException, XMPPException, KeyManagementException, NoSuchAlgorithmException { AbstractXMPPConnection connection = getConnection(); Resourcepart room = Resourcepart.from(jid.getLocalpart().asUnescapedString()); MultiUserChat muc = getMultiUserChat(connection, jid); muc.join(room); msg.setType(Message.Type.groupchat); muc.sendMessage(msg); connection.disconnect(); } @Autowired  XMPPNotification(); @Override void logNotification(ChaosNotification notification);  }### Answer:
@Test public void sendMultiUserMessage () throws Exception { Message msg = new Message(); EntityBareJid roomName = JidCreate.entityBareFrom(USER_1); AbstractXMPPConnection abstractXMPPConnection = Mockito.mock(AbstractXMPPConnection.class); doReturn(abstractXMPPConnection).when(xmppNotification).getConnection(); MultiUserChat multiUserChat = Mockito.mock(MultiUserChat.class); doReturn(multiUserChat).when(xmppNotification).getMultiUserChat(abstractXMPPConnection, roomName); xmppNotification.sendMultiUserMessage(msg, JidCreate.entityBareFrom(roomName)); assertEquals(Message.Type.groupchat, msg.getType()); verify(abstractXMPPConnection, times(1)).disconnect(); }