mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 12:02:05 +01:00
Merge pull request #589 from guusdk/sint_syncpoint_timeoutmessage
[sinttest] Carry over assertion message when sync point times out
This commit is contained in:
commit
37f4f35675
2 changed files with 6 additions and 2 deletions
|
@ -101,7 +101,7 @@ public abstract class AbstractSmackIntTest {
|
|||
|
||||
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) {
|
||||
|
|
|
@ -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;
|
||||
|
@ -46,7 +50,7 @@ public class ResultSyncPoint<R, E extends Exception> {
|
|||
if (exception != null) {
|
||||
throw exception;
|
||||
}
|
||||
throw new TimeoutException("Timeout expired");
|
||||
throw new TimeoutException(timeoutMessage == null ? "Timeout expired" : timeoutMessage);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue