@SuppressWarnings({"unchecked"})
    @Test
    public void testSubmitRunnable() {
        ExecutorService mockExecutorService = mock(ExecutorService.class);
        ArgumentCaptor<SubjectRunnable> captor = ArgumentCaptor.forClass(SubjectRunnable.class);
        when(mockExecutorService.submit(captor.capture())).thenReturn(new DummyFuture<>());

        final SubjectAwareExecutorService executor = new SubjectAwareExecutorService(mockExecutorService);

        runWithSubject(subject -> {
            Runnable testRunnable = () -> System.out.println("Hello World");

            executor.submit(testRunnable);
            SubjectRunnable subjectRunnable = captor.getValue();
            assertNotNull(subjectRunnable);
        });
    }
Test cases for the {@link SubjectAwareExecutorService} implementation.
core/src/test/java/org/apache/shiro/concurrent/SubjectAwareExecutorServiceTest.java