Beispiel #1
0
 @Test
 public void setIsDoneReturnsTrueIffThrowable() {
   Throwable throwable = mock(Throwable.class);
   assertThat(cut.isDone(), is(false));
   cut.setThrowable(throwable);
   assertThat(cut.isDone(), is(true));
 }
Beispiel #2
0
 @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();
 }