### Question:
ExecutorServiceHandlerRegistry { public static synchronized ExecutorService getExecutorServiceHandler(final String jobName, final ExecutorServiceHandler executorServiceHandler) { if (!REGISTRY.containsKey(jobName)) { REGISTRY.put(jobName, executorServiceHandler.createExecutorService(jobName)); } return REGISTRY.get(jobName); }  static synchronized ExecutorService getExecutorServiceHandler(final String jobName, final ExecutorServiceHandler executorServiceHandler); static synchronized void remove(final String jobName);  }### Answer:
@Test public void assertGetExecutorServiceHandlerForSameThread() { Assert.assertThat(ExecutorServiceHandlerRegistry.getExecutorServiceHandler("test_job", new DefaultExecutorServiceHandler()), Is.is(ExecutorServiceHandlerRegistry.getExecutorServiceHandler("test_job", new DefaultExecutorServiceHandler()))); }
@Test public void assertGetExecutorServiceHandlerForConcurrent() throws InterruptedException { int threadCount = 100; CyclicBarrier barrier = new CyclicBarrier(threadCount); ExecutorService executorService = Executors.newFixedThreadPool(threadCount); CountDownLatch latch = new CountDownLatch(threadCount); Set<ExecutorService> set = new CopyOnWriteArraySet<>(); for (int i = 0; i < threadCount; i++) { executorService.submit(new GetExecutorServiceHandlerTask(barrier, latch, set)); } latch.await(); Assert.assertThat(set.size(), Is.is(1)); Assert.assertThat(ExecutorServiceHandlerRegistry.getExecutorServiceHandler("test_job", new DefaultExecutorServiceHandler()), Is.is(set.iterator().next())); }