void () { ProjectDataManagerImpl dataManager = ProjectDataManagerImpl.getInstance(); ConcurrentDetectingDataService detectingService = new ConcurrentDetectingDataService(); maskProjectDataServices(detectingService); int degreeOfConcurrency = 2; CountDownLatch testStart = new CountDownLatch(1); AtomicInteger unfinishedImportsCount = new AtomicInteger(degreeOfConcurrency); final List<Thread> threads = Stream.generate(() -> createProjectDataStub()) .limit(degreeOfConcurrency) .map(p -> { @SuppressWarnings("SSBasedInspection") var t = new Thread( new RunAll(() -> testStart.await(), () -> dataManager.importData(p, myProject), () -> unfinishedImportsCount.decrementAndGet())); t.start(); return t; }).toList(); testStart.countDown(); PlatformTestUtil.waitWithEventsDispatching("Project Data Import did not finish in time", () -> unfinishedImportsCount.get() == 0, 5); joinAll(threads, 100); assertFalse("DataNodes must not be processed concurrently", detectingService.wasConcurrentRunDetected()); }