1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-25 21:42:07 +01:00

[sinttest] Improve test assertion message

Making use of the new assertion handling for MultiResultSyncPoint, the integration test that uses that implementation can now get improved assertion messages. This will allow users to more quickly determine why a test is failing.
This commit is contained in:
Guus der Kinderen 2024-06-13 15:32:23 +02:00
parent 440b497638
commit 7e9a5713e9

View file

@ -293,10 +293,10 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
try { try {
mucAsSeenByThree.join(nicknameThree); mucAsSeenByThree.join(nicknameThree);
List<Presence> results = syncPoint.waitForResults(timeout); List<Presence> results = assertResult(syncPoint, "Expected all occupants of room '" + mucAddress + "' to be notified of '" + conThree.getUser() + "' using nickname '" + nicknameThree + "' joining the room (but one or more did not get notified).");
assertTrue(results.stream().allMatch( assertTrue(results.stream().allMatch(
result -> JidCreate.fullFrom(mucAddress, nicknameThree).equals(result.getFrom())), result -> JidCreate.fullFrom(mucAddress, nicknameThree).equals(result.getFrom())),
"Expected all occupants of room '" + mucAddress + "' to be notified of '" + conThree.getUser() + "' using nickname '" + nicknameThree + "' joining the room (but one or more got notified )."); "Expected all occupants of room '" + mucAddress + "' to be notified of '" + conThree.getUser() + "' using nickname '" + nicknameThree + "' joining the room (but one or more got notified for a different user).");
assertTrue(results.stream().anyMatch( assertTrue(results.stream().anyMatch(
result -> result.getTo().equals(conOne.getUser().asEntityFullJidIfPossible())), result -> result.getTo().equals(conOne.getUser().asEntityFullJidIfPossible())),
"Expected '" + conOne.getUser().asEntityFullJidIfPossible() + "' to be notified of '" + conThree.getUser() + "' joining room '" + mucAddress + "' (but did not)"); "Expected '" + conOne.getUser().asEntityFullJidIfPossible() + "' to be notified of '" + conThree.getUser() + "' joining room '" + mucAddress + "' (but did not)");