@Test
public void testWhenAnyCompleteCancelOthers()
        throws Exception
{

    assertGetUncheckedListenable(future -> {
        SettableFuture<Object> future1 = SettableFuture.create();
        SettableFuture<Object> future3 = SettableFuture.create();
        Object result = getFutureValue(whenAnyCompleteCancelOthers(ImmutableList.of(future1, future, future3)));
        assertTrue(future1.isCancelled());
        assertTrue(future3.isCancelled());
        return result;
    });
    assertFailure(() -> whenAnyComplete(null), e -> assertInstanceOf(e, NullPointerException.class));
    assertFailure(() -> whenAnyComplete(ImmutableList.of()), e -> assertInstanceOf(e, IllegalArgumentException.class));
    assertEquals(
            tryGetFutureValue(whenAnyComplete(ImmutableList.of(SettableFuture.create(), SettableFuture.create())), 10, MILLISECONDS),
            Optional.empty());
}