@SuppressWarnings({"unchecked"}) @Test public void testSubmitRunnable() { ExecutorService mockExecutorService = createNiceMock(ExecutorService.class); expect(mockExecutorService.submit(isA(SubjectRunnable.class))).andReturn(new DummyFuture()); replay(mockExecutorService); final SubjectAwareExecutorService executor = new SubjectAwareExecutorService(mockExecutorService); Runnable testRunnable = new Runnable() { public void run() { System.out.println("Hello World"); } }; executor.submit(testRunnable); verify(mockExecutorService); }
public <T> Future<T> submit(Callable<T> task) { Callable<T> work = associateWithSubject(task); return this.targetExecutorService.submit(work); }
SubjectAwareExecutorService extends SubjectAwareExecutor implements ExecutorService { public <T> Future<T> submit(Callable<T> task) { Callable<T> work = associateWithSubject(task); return this.targetExecutorService.submit(work); } }
SubjectAwareExecutorService extends SubjectAwareExecutor implements ExecutorService { public <T> Future<T> submit(Callable<T> task) { Callable<T> work = associateWithSubject(task); return this.targetExecutorService.submit(work); } SubjectAwareExecutorService();  SubjectAwareExecutorService(ExecutorService target); }
SubjectAwareExecutorService extends SubjectAwareExecutor implements ExecutorService { public <T> Future<T> submit(Callable<T> task) { Callable<T> work = associateWithSubject(task); return this.targetExecutorService.submit(work); } SubjectAwareExecutorService();  SubjectAwareExecutorService(ExecutorService target); ExecutorService getTargetExecutorService(); void setTargetExecutorService(ExecutorService targetExecutorService); @Override void setTargetExecutor(Executor targetExecutor); void shutdown(); List<Runnable> shutdownNow(); boolean isShutdown(); boolean isTerminated(); boolean awaitTermination(long timeout, TimeUnit unit); Future<T> submit(Callable<T> task); Future<T> submit(Runnable task, T result); Future<?> submit(Runnable task); List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks); List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit); T invokeAny(Collection<? extends Callable<T>> tasks); T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit); }
SubjectAwareExecutorService extends SubjectAwareExecutor implements ExecutorService { public <T> Future<T> submit(Callable<T> task) { Callable<T> work = associateWithSubject(task); return this.targetExecutorService.submit(work); } SubjectAwareExecutorService();  SubjectAwareExecutorService(ExecutorService target); ExecutorService getTargetExecutorService(); void setTargetExecutorService(ExecutorService targetExecutorService); @Override void setTargetExecutor(Executor targetExecutor); void shutdown(); List<Runnable> shutdownNow(); boolean isShutdown(); boolean isTerminated(); boolean awaitTermination(long timeout, TimeUnit unit); Future<T> submit(Callable<T> task); Future<T> submit(Runnable task, T result); Future<?> submit(Runnable task); List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks); List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit); T invokeAny(Collection<? extends Callable<T>> tasks); T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit);  }