QueueingThreadPoolExecutor extends ThreadPoolExecutor { public static QueueingThreadPoolExecutor createInstance(String name, int threadPoolSize) { return new QueueingThreadPoolExecutor(name, threadPoolSize); } protected  QueueingThreadPoolExecutor(String name, int threadPoolSize); private  QueueingThreadPoolExecutor(String threadPoolName, ThreadFactory threadFactory, int threadPoolSize,
            RejectedExecutionHandler rejectionHandler); static QueueingThreadPoolExecutor createInstance(String name, int threadPoolSize); @Override void setRejectedExecutionHandler(RejectedExecutionHandler handler); @Override BlockingQueue<Runnable> getQueue(); @Override void execute(Runnable command);  }
@Test public void testCreateInstance() { String poolName = "testCreateInstance"; QueueingThreadPoolExecutor.createInstance(poolName, 1); QueueingThreadPoolExecutor.createInstance(poolName, 2); QueueingThreadPoolExecutor.createInstance(poolName, 5); QueueingThreadPoolExecutor.createInstance(poolName, 10); QueueingThreadPoolExecutor.createInstance(poolName, 1000); QueueingThreadPoolExecutor.createInstance(poolName, 10000); QueueingThreadPoolExecutor.createInstance(poolName, 100000); QueueingThreadPoolExecutor.createInstance(poolName, 1000000); assertFalse(areThreadsFromPoolRunning(poolName)); }
@Test public void testCreateInstanceInvalidArgsPoolNameNull() throws InterruptedException { assertThrows(IllegalArgumentException.class, () -> QueueingThreadPoolExecutor.createInstance(null, 1)); }
@Test public void testCreateInstanceInvalidArgsPoolSize0() { assertThrows(IllegalArgumentException.class, () -> QueueingThreadPoolExecutor.createInstance("test", 0)); }
@Test public void testCreateInstanceInvalidArgsPoolSizeMinus1() { assertThrows(IllegalArgumentException.class, () -> QueueingThreadPoolExecutor.createInstance("test", -1)); }