@Test public void sendDirectMessage () throws Exception { AbstractXMPPConnection abstractXMPPConnection = Mockito.mock(AbstractXMPPConnection.class); Message msg = new Message(); doReturn(abstractXMPPConnection).when(xmppNotification).getConnection(); xmppNotification.sendDirectMessage(msg, JidCreate.entityBareFrom(USER_1)); assertEquals(Message.Type.normal, msg.getType()); verify(abstractXMPPConnection, times(1)).disconnect(); }
void sendDirectMessage (Message msg, EntityBareJid jid) throws InterruptedException, IOException, SmackException, XMPPException, KeyManagementException, NoSuchAlgorithmException { AbstractXMPPConnection connection = getConnection(); Chat chat = getSimpleUserChat(connection, jid); msg.setType(Message.Type.normal); chat.send(msg); connection.disconnect(); }
XMPPNotification implements NotificationMethods { void sendDirectMessage (Message msg, EntityBareJid jid) throws InterruptedException, IOException, SmackException, XMPPException, KeyManagementException, NoSuchAlgorithmException { AbstractXMPPConnection connection = getConnection(); Chat chat = getSimpleUserChat(connection, jid); msg.setType(Message.Type.normal); chat.send(msg); connection.disconnect(); } }
XMPPNotification implements NotificationMethods { void sendDirectMessage (Message msg, EntityBareJid jid) throws InterruptedException, IOException, SmackException, XMPPException, KeyManagementException, NoSuchAlgorithmException { AbstractXMPPConnection connection = getConnection(); Chat chat = getSimpleUserChat(connection, jid); msg.setType(Message.Type.normal); chat.send(msg); connection.disconnect(); } @Autowired  XMPPNotification(); }
XMPPNotification implements NotificationMethods { void sendDirectMessage (Message msg, EntityBareJid jid) throws InterruptedException, IOException, SmackException, XMPPException, KeyManagementException, NoSuchAlgorithmException { AbstractXMPPConnection connection = getConnection(); Chat chat = getSimpleUserChat(connection, jid); msg.setType(Message.Type.normal); chat.send(msg); connection.disconnect(); } @Autowired  XMPPNotification(); @Override void logNotification(ChaosNotification notification); }
XMPPNotification implements NotificationMethods { void sendDirectMessage (Message msg, EntityBareJid jid) throws InterruptedException, IOException, SmackException, XMPPException, KeyManagementException, NoSuchAlgorithmException { AbstractXMPPConnection connection = getConnection(); Chat chat = getSimpleUserChat(connection, jid); msg.setType(Message.Type.normal); chat.send(msg); connection.disconnect(); } @Autowired  XMPPNotification(); @Override void logNotification(ChaosNotification notification);  }