Skip to content

Commit 1f92b82

Browse files
Add comment to testFutureFromRustCancel to explain if-statement in test
1 parent a282afe commit 1f92b82

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ public void testFutureFromRustCancel() {
6565
"Expected CancellationException as cause",
6666
e.getCause() instanceof java.util.concurrent.CancellationException);
6767
assertTrue(testFuture.isCancelled());
68+
} else {
69+
// The future completed before we could cancel it.
70+
// Oppurtunitically, let's just check that the future completed as expected.
71+
try {
72+
assertEquals(63, (int) testFuture.get());
73+
assertFalse(testFuture.isCancelled());
74+
} catch (ExecutionException | InterruptedException e) {
75+
fail("testFuture.get() threw an unexpected exception: " + e.getMessage());
76+
}
6877
}
6978
assertTrue(testFuture.isDone());
7079
}

0 commit comments

Comments
 (0)