@Test public void mapCancelationExceptionMessageTest() throws InterruptedException, TimeoutException { String msg = StringUtils.makeRandomString(5); SettableListenableFuture<Void> slf = new CancelMessageTestSettableListenableFuture(msg); ListenableFuture<Void> mappedFuture = slf.map((v) -> v); slf.cancel(false); verifyCancelationExceptionMessageOnGet(msg, mappedFuture); verifyCancelationExceptionMessageInCallback(msg, mappedFuture); }
@Test public void futureCallbackCancelationExceptionMessageTest() throws InterruptedException, TimeoutException { String msg = StringUtils.makeRandomString(5); SettableListenableFuture<Void> slf = new CancelMessageTestSettableListenableFuture(msg); slf.cancel(false); verifyCancelationExceptionMessageInCallback(msg, slf); }
@Test public void cancelationExceptionMessageTest() throws InterruptedException { String msg = StringUtils.makeRandomString(5); SettableListenableFuture<Void> slf = new CancelMessageTestSettableListenableFuture(msg); slf.cancel(false); verifyCancelationExceptionMessageOnGet(msg, slf); }
@Test public void failureFlatMapCancelationExceptionMessageAlreadyDoneTest() throws InterruptedException, TimeoutException { String msg = StringUtils.makeRandomString(5); SettableListenableFuture<Void> slf = new CancelMessageTestSettableListenableFuture(msg); slf.cancel(false); ListenableFuture<Void> mappedFuture = slf.flatMapFailure(CancellationException.class, (c) -> FutureUtils.immediateFailureFuture(c)); verifyCancelationExceptionMessageOnGet(msg, mappedFuture); verifyCancelationExceptionMessageInCallback(msg, mappedFuture); }
@Test public void flatMapCancelationExceptionMessageTest() throws InterruptedException, TimeoutException { String msg = StringUtils.makeRandomString(5); SettableListenableFuture<Void> slf = new CancelMessageTestSettableListenableFuture(msg); ListenableFuture<Void> mappedFuture = slf.flatMap((v) -> FutureUtils.immediateResultFuture(null)); slf.cancel(false); verifyCancelationExceptionMessageOnGet(msg, mappedFuture); verifyCancelationExceptionMessageInCallback(msg, mappedFuture); }
@Test public void failureFlatMapCancelationExceptionMessageTest() throws InterruptedException, TimeoutException { String msg = StringUtils.makeRandomString(5); SettableListenableFuture<Void> slf = new CancelMessageTestSettableListenableFuture(msg); ListenableFuture<Void> mappedFuture = slf.flatMapFailure(CancellationException.class, (c) -> FutureUtils.immediateFailureFuture(c)); slf.cancel(false); verifyCancelationExceptionMessageOnGet(msg, mappedFuture); verifyCancelationExceptionMessageInCallback(msg, mappedFuture); }
@Test public void failureMapCancelationExceptionMessageAlreadyDoneTest() throws InterruptedException, TimeoutException { String msg = StringUtils.makeRandomString(5); SettableListenableFuture<Void> slf = new CancelMessageTestSettableListenableFuture(msg); slf.cancel(false); ListenableFuture<Void> mappedFuture = slf.mapFailure(CancellationException.class, (c) -> { throw c; }); verifyCancelationExceptionMessageOnGet(msg, mappedFuture); verifyCancelationExceptionMessageInCallback(msg, mappedFuture); }
@Test public void flatMapCancelationExceptionMessageAlreadyDoneTest() throws InterruptedException, TimeoutException { String msg = StringUtils.makeRandomString(5); SettableListenableFuture<Void> slf = new CancelMessageTestSettableListenableFuture(msg); slf.cancel(false); ListenableFuture<Void> mappedFuture = slf.flatMap((v) -> FutureUtils.immediateResultFuture(null)); verifyCancelationExceptionMessageOnGet(msg, mappedFuture); verifyCancelationExceptionMessageInCallback(msg, mappedFuture); }
@Test public void mapCancelationExceptionMessageAlreadyDoneTest() throws InterruptedException, TimeoutException { String msg = StringUtils.makeRandomString(5); SettableListenableFuture<Void> slf = new CancelMessageTestSettableListenableFuture(msg); slf.cancel(false); ListenableFuture<Void> mappedFuture = slf.map((v) -> v); verifyCancelationExceptionMessageOnGet(msg, mappedFuture); verifyCancelationExceptionMessageInCallback(msg, mappedFuture); }
@Test public void failureMapCancelationExceptionMessageTest() throws InterruptedException, TimeoutException { String msg = StringUtils.makeRandomString(5); SettableListenableFuture<Void> slf = new CancelMessageTestSettableListenableFuture(msg); ListenableFuture<Void> mappedFuture = slf.mapFailure(CancellationException.class, (c) -> { throw c; }); slf.cancel(false); verifyCancelationExceptionMessageOnGet(msg, mappedFuture); verifyCancelationExceptionMessageInCallback(msg, mappedFuture); }