@Test
    public void testExecute() {
        Executor targetMockExecutor = mock(Executor.class);
        final SubjectAwareExecutor executor = new SubjectAwareExecutor(targetMockExecutor);

        Runnable work = () -> System.out.println("Hello World");
        runWithSubject(subject -> executor.execute(work));

        //* ensure the target Executor receives a SubjectRunnable instance that retains the subject identity:
        //(this is what verifies the test is valid):
        ArgumentCaptor<SubjectRunnable> subjectRunnableArgumentCaptor = ArgumentCaptor.forClass(SubjectRunnable.class);
        verify(targetMockExecutor).execute(subjectRunnableArgumentCaptor.capture());
        SubjectRunnable subjectRunnable = subjectRunnableArgumentCaptor.getValue();
        assertNotNull(subjectRunnable);
    }
Test cases for the {@link SubjectAwareExecutor} implementation.

@since 1.0
core/src/test/java/org/apache/shiro/concurrent/SubjectAwareExecutorTest.java