I need to unit-test some functionality that works across threads, for which I need to guarantee that two jobs are run on different threads.
Using Executors.newCachedThreadPool() introduces a race-condition, because the test may or may not use the cached thread-pool.
Is there an ExecutorService that always uses a new thread?