void () { Map<SearchEverywhereContributor<Object>, Integer> contributorsMap = new HashMap<>(); contributorsMap.put(new ReadActionContributor("readAction1", 0, 0, Arrays.asList("ri11", "ri12", "ri13", "ri14", "ri15", "ri16")), 5); contributorsMap.put(new WriteActionContributor("writeAction1", 500, 0, Arrays.asList("wi11", "wi12", "wi13", "wi14")), 5); Collector collector = new Collector(); Alarm alarm = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, getTestRootDisposable()); SESearcher searcher = new GroupedResultsSearcher(collector, command -> alarm.addRequest(command, 0), ourEqualityProviders); ProgressIndicator progressIndicator = searcher.search(contributorsMap, "tst"); try { if (!collector.awaitFinish(4000)) { Assert.fail("Searching still haven't finished. Possible deadlock"); } Assert.assertEquals(Arrays.asList("ri11", "ri12", "ri13", "ri14", "ri15"), collector.getFoundItems("readAction1")); Assert.assertEquals(Arrays.asList("wi11", "wi12", "wi13", "wi14"), collector.getFoundItems("writeAction1")); } catch (InterruptedException ignored) { } finally { progressIndicator.cancel(); } }