/** @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); }
/** @throws Exception */ @Test public void get() throws Exception { String value = "hoge"; FakeFuture<String> future = new FakeFuture<String>(value); assertThat(FutureUtil.get(future), is(value)); }