The writer of this test misunderstood ThreadPoolExecutor.
The test adds Threads as tasks to a ThreadPoolExecutor and then calls join on the Thread objects. But these are not the running threads, it work by pure accident, because Thread happens to implement Runnable.
The join will always return immediately, because the thread never ran.
This should instead synchronize on the Future returned from submit instead, otherwise there is no guarantee that the threads in the pool actually finished.