@Test public void testExecute() { Executor targetMockExecutor = createNiceMock(Executor.class); targetMockExecutor.execute(isA(SubjectRunnable.class)); replay(targetMockExecutor); final SubjectAwareExecutor executor = new SubjectAwareExecutor(targetMockExecutor); Runnable work = new Runnable() { public void run() { System.out.println("Hello World"); } }; executor.execute(work); verify(targetMockExecutor); }
public void execute(Runnable command) { Runnable associated = associateWithSubject(command); getTargetExecutor().execute(associated); }
SubjectAwareExecutor implements Executor { public void execute(Runnable command) { Runnable associated = associateWithSubject(command); getTargetExecutor().execute(associated); } }
SubjectAwareExecutor implements Executor { public void execute(Runnable command) { Runnable associated = associateWithSubject(command); getTargetExecutor().execute(associated); } SubjectAwareExecutor();  SubjectAwareExecutor(Executor targetExecutor); }
SubjectAwareExecutor implements Executor { public void execute(Runnable command) { Runnable associated = associateWithSubject(command); getTargetExecutor().execute(associated); } SubjectAwareExecutor();  SubjectAwareExecutor(Executor targetExecutor); Executor getTargetExecutor(); void setTargetExecutor(Executor targetExecutor); void execute(Runnable command); }
SubjectAwareExecutor implements Executor { public void execute(Runnable command) { Runnable associated = associateWithSubject(command); getTargetExecutor().execute(associated); } SubjectAwareExecutor();  SubjectAwareExecutor(Executor targetExecutor); Executor getTargetExecutor(); void setTargetExecutor(Executor targetExecutor); void execute(Runnable command);  }