@Test
public void testExecuteJob05() throws Exception {

    doReturn(true).when(asyncJobWorker).beforeExecute(anyString());
    doNothing().when(asyncJobWorker).executeWorker(anyString());
    Semaphore semaphore = new Semaphore(10);
    doAnswer(new Answer<Object>() {
        @Override
        public Object answer(InvocationOnMock invocationOnMock)
                throws Throwable {
            Runnable runnable = invocationOnMock.getArgumentAt(0,
                    Runnable.class);
            runnable.run();
            return null;
        }
    }).when(threadPoolTaskExecutor).execute(any(Runnable.class));
    AsyncJobLauncherImpl asyncJobLauncher = new AsyncJobLauncherImpl(
            threadPoolTaskExecutor, asyncJobWorker);
    asyncJobLauncher.taskPoolLimit = semaphore;
    // テスト実行
    asyncJobLauncher.executeJob("0000000001");
    // AsyncJobWorker#executeWorker()が呼び出されていること。
    verify(asyncJobWorker).executeWorker("0000000001");
    // セマフォのサイズが元の値に戻っていること。
    assertEquals(10, semaphore.availablePermits());
}