1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 22:32:06 +01:00

test: created mocked connectionwith stanza factory

This commit is contained in:
Florian Schmaus 2019-10-29 10:40:41 +01:00
parent 4b01892129
commit 36072fb25a

View file

@ -30,6 +30,8 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.filter.StanzaFilter;
import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.packet.StanzaFactory;
import org.jivesoftware.smack.packet.id.StandardStanzaIdSource;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
@ -78,6 +80,9 @@ public class ConnectionUtils {
when(connection.getUser()).thenReturn(initiatorJID); when(connection.getUser()).thenReturn(initiatorJID);
when(connection.getXMPPServiceDomain()).thenReturn(xmppServer); when(connection.getXMPPServiceDomain()).thenReturn(xmppServer);
final StanzaFactory stanzaFactory = new StanzaFactory(new StandardStanzaIdSource());
when(connection.getStanzaFactory()).thenReturn(stanzaFactory);
// mock packet collector // mock packet collector
final StanzaCollector collector = mock(StanzaCollector.class); final StanzaCollector collector = mock(StanzaCollector.class);
when(connection.createStanzaCollector(isA(StanzaFilter.class))).thenReturn( when(connection.createStanzaCollector(isA(StanzaFilter.class))).thenReturn(