1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-30 14:37:59 +01:00

[sinttest] Use MultiUserChat.getMyRoomJid() in integration test

This commit is contained in:
Florian Schmaus 2021-12-20 22:40:55 +01:00
parent e530db2e6d
commit b3637101ce

View file

@ -35,7 +35,7 @@ import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;
import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.impl.JidCreate;
import org.jxmpp.jid.EntityFullJid;
import org.jxmpp.jid.parts.Resourcepart;
public class MultiUserChatEntityIntegrationTest extends AbstractMultiUserChatIntegrationTest {
@ -176,12 +176,17 @@ public class MultiUserChatEntityIntegrationTest extends AbstractMultiUserChatInt
MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
final Resourcepart nicknameOne = Resourcepart.from("one-" + randomString);
createMuc(mucAsSeenByOne, nicknameOne);
final EntityFullJid mucAsSeenByOneUserJid = mucAsSeenByOne.getMyRoomJid();
// Ensure that we do not invoke discoverItems() with null below. This should not happen, as the room JID should
// be non-null after we created and joined the room. But it can not hurt to explicitly test for it either.
if (mucAsSeenByOneUserJid == null) {
throw new AssertionError();
}
XMPPException.XMPPErrorException xe;
try {
xe = assertThrows(XMPPException.XMPPErrorException.class,
() -> ServiceDiscoveryManager.getInstanceFor(conTwo).discoverItems(
JidCreate.entityFullFrom(mucAddress, nicknameOne), null));
() -> ServiceDiscoveryManager.getInstanceFor(conTwo).discoverItems(mucAsSeenByOneUserJid));
} finally {
tryDestroy(mucAsSeenByOne);
}