Skip to content

Commit

Permalink
Merge 77dc527 into 2e94599
Browse files Browse the repository at this point in the history
  • Loading branch information
guusdk committed Apr 17, 2024
2 parents 2e94599 + 77dc527 commit 842d7e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Expand Up @@ -101,7 +101,7 @@ public <R> R assertResult(ResultSyncPoint<R, ?> syncPoint, String message) throw

public static <R> R assertResult(ResultSyncPoint<R, ?> syncPoint, long timeout, String message) throws InterruptedException, TimeoutException, AssertionFailedError {
try {
return syncPoint.waitForResult(timeout);
return syncPoint.waitForResult(timeout, message);
} catch (InterruptedException | TimeoutException e) {
throw e;
} catch (Exception e) {
Expand Down
Expand Up @@ -26,6 +26,10 @@ public class ResultSyncPoint<R, E extends Exception> {
private E exception;

public R waitForResult(long timeout) throws E, InterruptedException, TimeoutException {
return waitForResult(timeout, null);
}

public R waitForResult(long timeout, String timeoutMessage) throws E, InterruptedException, TimeoutException {
synchronized (this) {
if (result != null) {
return result;
Expand All @@ -46,7 +50,7 @@ public R waitForResult(long timeout) throws E, InterruptedException, TimeoutExce
if (exception != null) {
throw exception;
}
throw new TimeoutException("Timeout expired");
throw new TimeoutException(timeoutMessage == null ? "Timeout expired" : timeoutMessage);
}


Expand Down

0 comments on commit 842d7e9

Please sign in to comment.