From d2810cf9b6c9f91d57269040a65c133eeebbbe07 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 20 May 2024 23:09:45 +0200 Subject: [PATCH] [sinttest] Move throw statement before setting the listener in mucDestroyTest() Also add tryDestroy(muc). --- .../smackx/muc/MultiUserChatIntegrationTest.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatIntegrationTest.java index ec18b6c562..89852a5fb4 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatIntegrationTest.java @@ -99,6 +99,12 @@ public void mucDestroyTest() throws TimeoutException, Exception { MultiUserChat muc = mucManagerOne.getMultiUserChat(mucAddress); createMuc(muc, Resourcepart.from("one-" + randomString)); + // These would be a test implementation bug, not assertion failure. + if (!mucManagerOne.getJoinedRooms().contains(mucAddress)) { + tryDestroy(muc); + throw new IllegalStateException("Expected user to have joined a room '" + mucAddress + "' (but does not appear to have done so)."); + } + final SimpleResultSyncPoint mucDestroyed = new SimpleResultSyncPoint(); UserStatusListener userStatusListener = new UserStatusListener() { @@ -110,11 +116,6 @@ public void roomDestroyed(MultiUserChat alternateMUC, String reason) { muc.addUserStatusListener(userStatusListener); - // These would be a test implementation bug, not assertion failure. - if (!mucManagerOne.getJoinedRooms().contains(mucAddress)) { - throw new IllegalStateException("Expected user to have joined a room '" + mucAddress + "' (but does not appear to have done so)."); - } - try { muc.destroy("Dummy reason", null); assertResult(mucDestroyed, "Expected " + conOne.getUser() + " to be notified of destruction of room " + mucAddress + " (but was not).");