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

          @Override
          public String get() throws InterruptedException, ExecutionException {
            throw new ExecutionException(new Exception("Hoge"));
          }
        };
    FutureUtil.getQuietly(future);
  }
예제 #2
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);
  }
예제 #3
0
 /** @throws Exception */
 @Test
 public void getQuietly() throws Exception {
   String value = "hoge";
   FakeFuture<String> future = new FakeFuture<String>(value);
   assertThat(FutureUtil.getQuietly(future), is(value));
 }