@Test public void immediateApplyThrows() throws Exception { doThrow(cause).when(fn).apply(from); assertThat(base.thenApplyCompleted(fn, from), is(new ImmediateFailed<>(caller, cause))); }
<U> Stage<U> thenApplyCompleted( final Function<? super T, ? extends U> fn, final T value ) { final U result; try { result = fn.apply(value); } catch (final Exception e) { return new ImmediateFailed<>(caller, e); } return new ImmediateCompleted<>(caller, result); }
AbstractImmediate implements Stage<T> { <U> Stage<U> thenApplyCompleted( final Function<? super T, ? extends U> fn, final T value ) { final U result; try { result = fn.apply(value); } catch (final Exception e) { return new ImmediateFailed<>(caller, e); } return new ImmediateCompleted<>(caller, result); } }
AbstractImmediate implements Stage<T> { <U> Stage<U> thenApplyCompleted( final Function<? super T, ? extends U> fn, final T value ) { final U result; try { result = fn.apply(value); } catch (final Exception e) { return new ImmediateFailed<>(caller, e); } return new ImmediateCompleted<>(caller, result); }  }
AbstractImmediate implements Stage<T> { <U> Stage<U> thenApplyCompleted( final Function<? super T, ? extends U> fn, final T value ) { final U result; try { result = fn.apply(value); } catch (final Exception e) { return new ImmediateFailed<>(caller, e); } return new ImmediateCompleted<>(caller, result); }   }
AbstractImmediate implements Stage<T> { <U> Stage<U> thenApplyCompleted( final Function<? super T, ? extends U> fn, final T value ) { final U result; try { result = fn.apply(value); } catch (final Exception e) { return new ImmediateFailed<>(caller, e); } return new ImmediateCompleted<>(caller, result); }    }