mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 12:02:05 +01:00
[sinttest] Refactor MultiResulitSyncPoint TimeoutException message construction for readability
This commit is contained in:
parent
68fa90435e
commit
9254f735c7
2 changed files with 10 additions and 2 deletions
|
@ -44,7 +44,15 @@ public class MultiResultSyncPoint<R, E extends Exception> {
|
|||
wait(deadline - now);
|
||||
now = System.currentTimeMillis();
|
||||
}
|
||||
if (now >= deadline) throw new TimeoutException((timeoutMessage != null ? timeoutMessage + " " : "") + "MultiResultSyncPoint timeout waiting " + timeout + " millis. Got " + results.size() + " results of " + expectedResultCount + " results");
|
||||
if (now >= deadline) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (timeoutMessage != null) {
|
||||
sb.append(timeoutMessage).append(". ");
|
||||
}
|
||||
sb.append("MultiResultSyncPoint timeout waiting " + timeout + " ms. Got " + results.size() + " results of " + expectedResultCount + " results");
|
||||
|
||||
throw new TimeoutException(sb.toString());
|
||||
}
|
||||
if (exception != null) throw exception;
|
||||
return new ArrayList<>(results);
|
||||
}
|
||||
|
|
|
@ -292,7 +292,7 @@ public class MultiUserChatOccupantIntegrationTest extends AbstractMultiUserChatI
|
|||
try {
|
||||
mucAsSeenByThree.join(nicknameThree);
|
||||
|
||||
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).");
|
||||
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(
|
||||
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 for a different user).");
|
||||
|
|
Loading…
Reference in a new issue