Skip to content

Commit a282afe

Browse files
committed
Fix testFutureFromRustCancel
1 parent bf1e08b commit a282afe

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

java/shared/test/java/org/signal/libsignal/internal/FutureTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,13 @@ public void testFutureFromRustCancel() {
5959
(nativeContextHandle) ->
6060
NativeTesting.TESTING_TokioAsyncFuture(nativeContextHandle, 21))
6161
.makeCancelable(context);
62-
assertTrue(testFuture.cancel(true));
63-
ExecutionException e = assertThrows(ExecutionException.class, () -> testFuture.get());
64-
assertTrue(
65-
"Expected CancellationException as cause",
66-
e.getCause() instanceof java.util.concurrent.CancellationException);
67-
assertTrue(testFuture.isCancelled());
62+
if (testFuture.cancel(true)) {
63+
ExecutionException e = assertThrows(ExecutionException.class, () -> testFuture.get());
64+
assertTrue(
65+
"Expected CancellationException as cause",
66+
e.getCause() instanceof java.util.concurrent.CancellationException);
67+
assertTrue(testFuture.isCancelled());
68+
}
6869
assertTrue(testFuture.isDone());
6970
}
7071

0 commit comments

Comments
 (0)