@Test
public void testModifyCancelableUnmodifiableFuture()
{

    CompletableFuture<String> future = new CompletableFuture<>();
    CompletableFuture<String> unmodifiableFuture = unmodifiableFuture(future, true);
    // completion results in an UnsupportedOperationException
    assertFailure(() -> unmodifiableFuture.complete("fail"), e -> assertInstanceOf(e, UnsupportedOperationException.class));
    assertFalse(future.isDone());
    assertFalse(unmodifiableFuture.isDone());
    assertFailure(() -> unmodifiableFuture.completeExceptionally(new IOException()), e -> assertInstanceOf(e, UnsupportedOperationException.class));
    assertFalse(future.isDone());
    assertFalse(unmodifiableFuture.isDone());
    assertFailure(() -> unmodifiableFuture.obtrudeValue("fail"), e -> assertInstanceOf(e, UnsupportedOperationException.class));
    assertFalse(future.isDone());
    assertFalse(unmodifiableFuture.isDone());
    assertFailure(() -> unmodifiableFuture.obtrudeException(new IOException()), e -> assertInstanceOf(e, UnsupportedOperationException.class));
    assertFalse(future.isDone());
    assertFalse(unmodifiableFuture.isDone());
    // cancel is propagated so test separately
}