@Test
public void testExecuteJob09() throws Exception {

    final RuntimeException runtimeException = new RuntimeException(
            "exception in AsyncJobWorker#executeWorker()");
    doReturn(true).when(asyncJobWorker).beforeExecute(anyString());
    doThrow(runtimeException).when(asyncJobWorker)
            .executeWorker("0000000001");
    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());
    // ExceptionStatusHandlerImplでのログが出力されていること。
    assertThat(logger.getLoggingEvents(), is(asList(error(runtimeException,
            "[EAL025053] An exception occurred. please see below the stacktrace."))));
}