Code example for Executor

Methods: execute

0
    @Test 
    public void testExecute() { 
        Executor targetMockExecutor = createNiceMock(Executor.class);
        //* ensure the target Executor receives a SubjectRunnable instance that retains the subject identity: 
        //(this is what verifies the test is valid): 
        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);
    } 
}