private static void assertConcurrent(final String message, final List<? extends CheckedRunnable> runnables,
                                         final int maxTimeoutSeconds) throws InterruptedException {
        val numThreads = runnables.size();
        val exceptions = Collections.synchronizedList(new ArrayList<>());
        try (val threadPool = Executors.newFixedThreadPool(numThreads)) {
            val allExecutorThreadsReady = new CountDownLatch(numThreads);
            val afterInitBlocker = new CountDownLatch(1);
            val allDone = new CountDownLatch(numThreads);
            for (val submittedTestRunnable : runnables) {
                threadPool.execute(() -> {
                    allExecutorThreadsReady.countDown();
                    try {
                        afterInitBlocker.await();
                        submittedTestRunnable.run();
                    } catch (final Throwable e) {
                        exceptions.add(e);
                    } finally {
                        allDone.countDown();
                    }
                });
            }
            assertTrue(allExecutorThreadsReady.await(runnables.size() * 10L, TimeUnit.MILLISECONDS),
                "Timeout initializing threads! Perform long lasting initializations before passing runnables to assertConcurrent");
            afterInitBlocker.countDown();
            assertTrue(allDone.await(maxTimeoutSeconds, TimeUnit.SECONDS), () -> message + " timeout! More than " + maxTimeoutSeconds + " seconds");
            threadPool.shutdownNow();
        }
        assertTrue(exceptions.isEmpty(), () -> message + " failed with exception(s)" + exceptions);
    }
Assert a list of runnables can run in parallel without any concurrency related exceptions.
Use CountDownLatch to start all threads at same time and wait for them to finish.

@param message           error message
@param runnables         list of runnables
@param maxTimeoutSeconds timeout for test completion
@throws InterruptedException interruption
support/cas-server-support-person-directory/src/test/java/org/apereo/cas/PersonDirectoryPrincipalResolverConcurrencyTests.java