@Test
public void test() throws Exception {

    ThreadInterruptedCompletableFuture<?> foo = new ThreadInterruptedCompletableFuture<>();
    boolean[] result = new boolean[2];
    Thread t = new Thread() {
        @Override
        public void run() {
            result[0] = foo.cancel(true);
            result[1] = Thread.currentThread().isInterrupted();
        }
    };
    t.start();
    t.interrupt();
    t.join(100);
    assertFalse(result[0]);
    assertTrue(result[1]);
}