Skip to content

Commit

Permalink
[sinttest] Refactor MultiResulitSyncPoint TimeoutException message co…
Browse files Browse the repository at this point in the history
…nstruction for readability
  • Loading branch information
Flowdalic committed Jun 27, 2024
1 parent 68fa904 commit 9254f73
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@ public synchronized List<R> waitForResults(long timeout, String timeoutMessage)
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public void mucJoinPresenceBroadcastTest() throws Exception {
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).");
Expand Down

0 comments on commit 9254f73

Please sign in to comment.