Example #1
0
  /** @throws Exception */
  @Test(expected = Error.class)
  public void getWhenErrorOccurred() throws Exception {
    String value = "hoge";
    FakeFuture<String> future =
        new FakeFuture<String>(value) {

          @Override
          public String get() throws InterruptedException, ExecutionException {
            throw new ExecutionException(new Error("Hoge"));
          }
        };
    FutureUtil.get(future);
  }
Example #2
0
 /** @throws Exception */
 @Test
 public void get() throws Exception {
   String value = "hoge";
   FakeFuture<String> future = new FakeFuture<String>(value);
   assertThat(FutureUtil.get(future), is(value));
 }