@Test
public void testSetupFlowByMultipleThreads() {

  final int threadNum = 4;
  final ExecutableFlow[] executableFlows = new ExecutableFlow[]{
      mockExecutableFlow(1, FAT_PROJECT_ID, 34),
      mockExecutableFlow(2, FAT_PROJECT_ID, 34),
      mockExecutableFlow(3, FAT_PROJECT_ID, 34),
      mockExecutableFlow(4, FAT_PROJECT_ID, 34)
  };
  final ExecutorService service = Executors.newFixedThreadPool(threadNum);
  final List<Future> futures = new ArrayList<>();
  for (int i = 0; i < threadNum; i++) {
    final int finalI = i;
    futures.add(service.submit(() -> {
      assertThatCode(() -> this.instance.setup(executableFlows[finalI])
      ).doesNotThrowAnyException();
    }));
  }
  for (final Future future : futures) {
    assertThatCode(() -> future.get()).doesNotThrowAnyException();
  }
  service.shutdownNow();
  for (final ExecutableFlow flow : executableFlows) {
    final File execDir = new File(this.executionsDir, String.valueOf(flow.getExecutionId()));
    assertTrue(execDir.exists());
    assertTrue(new File(execDir, SAMPLE_FLOW_01).exists());
  }
}