AsyncJobLauncherImpl implements AsyncJobLauncher,
                                  InitializingBean { protected boolean terminated(ThreadPoolExecutor threadPoolExecutor) { try { return threadPoolExecutor.awaitTermination( executorJobTerminateWaitIntervalTime, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { } return false; } AsyncJobLauncherImpl(ThreadPoolTaskExecutor threadPoolTaskExecutor,
            AsyncJobWorker asyncJobWorker); void setFair(boolean fair); @Override void executeJob(final String jobSequenceId); @Override void shutdown(); @Override void afterPropertiesSet();  }
@Test public void testTerminated01() throws Exception { AsyncJobLauncherImpl asyncJobLauncher = new AsyncJobLauncherImpl( threadPoolTaskExecutor, asyncJobWorker); ThreadPoolExecutor mockThreadPoolExecutor = mock(ThreadPoolExecutor.class); doReturn(true).when(mockThreadPoolExecutor).awaitTermination( anyLong(), eq(TimeUnit.MILLISECONDS)); assertThat(asyncJobLauncher.terminated(mockThreadPoolExecutor), is(true)); }
@Test public void testTerminated02() throws Exception { AsyncJobLauncherImpl asyncJobLauncher = new AsyncJobLauncherImpl( threadPoolTaskExecutor, asyncJobWorker); ThreadPoolExecutor mockThreadPoolExecutor = mock(ThreadPoolExecutor.class); doReturn(false).when(mockThreadPoolExecutor).awaitTermination( anyLong(), eq(TimeUnit.MILLISECONDS)); assertThat(asyncJobLauncher.terminated(mockThreadPoolExecutor), is(false)); }
@Test public void testTerminated03() throws Exception { AsyncJobLauncherImpl asyncJobLauncher = new AsyncJobLauncherImpl( threadPoolTaskExecutor, asyncJobWorker); ThreadPoolExecutor mockThreadPoolExecutor = mock(ThreadPoolExecutor.class); doThrow(new InterruptedException()).when(mockThreadPoolExecutor).awaitTermination( anyLong(), eq(TimeUnit.MILLISECONDS)); assertThat(asyncJobLauncher.terminated(mockThreadPoolExecutor), is(false)); }