@Test @SuppressWarnings("unchecked") public void propagatesRejectionThroughSubmit() { doThrow(REJECTED_EXECUTION_EXCEPTION).when(delegate).submit(any(Callable.class)); assertThatThrownBy(() -> checkedRejectionExecutor.submit(RETURN_ONE)) .isInstanceOf(CheckedRejectedExecutionException.class) .hasCause(REJECTED_EXECUTION_EXCEPTION); }
public <T> Future<T> submit(Callable<T> callable) throws CheckedRejectedExecutionException { try { return underlying.submit(callable); } catch (RejectedExecutionException ex) { throw new CheckedRejectedExecutionException(ex); } }
CheckedRejectionExecutorService { public <T> Future<T> submit(Callable<T> callable) throws CheckedRejectedExecutionException { try { return underlying.submit(callable); } catch (RejectedExecutionException ex) { throw new CheckedRejectedExecutionException(ex); } } }
CheckedRejectionExecutorService { public <T> Future<T> submit(Callable<T> callable) throws CheckedRejectedExecutionException { try { return underlying.submit(callable); } catch (RejectedExecutionException ex) { throw new CheckedRejectedExecutionException(ex); } } CheckedRejectionExecutorService(ExecutorService underlying); }
CheckedRejectionExecutorService { public <T> Future<T> submit(Callable<T> callable) throws CheckedRejectedExecutionException { try { return underlying.submit(callable); } catch (RejectedExecutionException ex) { throw new CheckedRejectedExecutionException(ex); } } CheckedRejectionExecutorService(ExecutorService underlying); void execute(Runnable runnable); Future<T> submit(Callable<T> callable); }
CheckedRejectionExecutorService { public <T> Future<T> submit(Callable<T> callable) throws CheckedRejectedExecutionException { try { return underlying.submit(callable); } catch (RejectedExecutionException ex) { throw new CheckedRejectedExecutionException(ex); } } CheckedRejectionExecutorService(ExecutorService underlying); void execute(Runnable runnable); Future<T> submit(Callable<T> callable);  }