public void testCustomThreadFactory() { ThreadingProfile profile = new ThreadingProfile(); ThreadFactory configuredFactory = new ThreadFactory() { public Thread newThread(Runnable r) { return null; } }; profile.setThreadFactory(configuredFactory); ThreadPoolExecutor pool = profile.createPool(); ThreadFactory returnedFactory = pool.getThreadFactory(); assertSame(configuredFactory, returnedFactory); }
public void testDefaultNamedThreadFactory() { ThreadingProfile profile = new ThreadingProfile(); ThreadPoolExecutor pool = profile.createPool("myThreadPool"); ThreadFactory returnedFactory = pool.getThreadFactory(); assertTrue(returnedFactory instanceof NamedThreadFactory); }
public void testDefaultThreadFactory() { ThreadingProfile profile = new ThreadingProfile(); ThreadPoolExecutor pool = profile.createPool(); ThreadFactory returnedFactory = pool.getThreadFactory(); assertTrue(returnedFactory.getClass().isInstance(Executors.defaultThreadFactory())); }