From b3637101ced7921ba62820b0d1c7b47cc08c3f70 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 20 Dec 2021 22:40:55 +0100 Subject: [PATCH] [sinttest] Use MultiUserChat.getMyRoomJid() in integration test --- .../muc/MultiUserChatEntityIntegrationTest.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatEntityIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatEntityIntegrationTest.java index 5f38182d4..279160c0f 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatEntityIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatEntityIntegrationTest.java @@ -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); }