Skip to content

Commit

Permalink
[sinttest] Move throw statement before setting the listener in mucDes…
Browse files Browse the repository at this point in the history
…troyTest()

Also add tryDestroy(muc).
  • Loading branch information
Flowdalic committed May 20, 2024
1 parent bf6b7bd commit d2810cf
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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).");
Expand Down

0 comments on commit d2810cf

Please sign in to comment.