1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-25 12:08:00 +01:00

[sinttest] Move throw statement before setting the listener in mucDestroyTest()

Also add tryDestroy(muc).
This commit is contained in:
Florian Schmaus 2024-05-20 23:09:45 +02:00
parent bf6b7bd692
commit d2810cf9b6

View file

@ -99,6 +99,12 @@ public class MultiUserChatIntegrationTest extends AbstractMultiUserChatIntegrati
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 class MultiUserChatIntegrationTest extends AbstractMultiUserChatIntegrati
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).");