ExecutorUtils { static ThreadFactory getNamedThreadFactory(final String threadNameTemplate) { final AtomicLong count = new AtomicLong(1); return runnable -> { final Thread thread = Executors.defaultThreadFactory().newThread(runnable); thread.setName(threadNameTemplate + count.getAndIncrement()); return thread; }; } private  ExecutorUtils(); static ExecutorService buildThreadPoolExecutorService(String name); static ScheduledExecutorService buildSingleThreadScheduledExecutorService(String name);  }
@Test public void testGetNamedThreadFactory() throws Exception { verifyGetNamedThreadFactory(THREAD_FACTORY_NAME); }