@Test public void setIsDoneReturnsTrueIffThrowable() { Throwable throwable = mock(Throwable.class); assertThat(cut.isDone(), is(false)); cut.setThrowable(throwable); assertThat(cut.isDone(), is(true)); }
@Test public void setThrowableLeadsToThrowable() throws CancellationException, InterruptedException { Throwable throwable = mock(Throwable.class); cut.setThrowable(throwable); try { cut.get(); } catch (ExecutionException e) { assertThat(e.getCause(), is(throwable)); return; } fail(); }