void (@NotNull PsiMethod streamMethod) { final JavaFindUsagesHandlerFactory factory = JavaFindUsagesHandlerFactory.getInstance(getProject()); JavaFindUsagesHandler handler = new JavaFindUsagesHandler(streamMethod, factory); ClusteringSearchSession session = new ClusteringSearchSession(); handler.processElementUsages(streamMethod, info -> { try { ReadAction.nonBlocking(() -> { Usage usage = UsageInfoToUsageConverter.convertToSimilarUsage(new PsiMethod[]{streamMethod}, info, session); ((UsageInfo2UsageAdapter)usage).updateCachedPresentation(); }).submit(AppExecutorUtil.getAppExecutorService()).get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } return true; }, factory.getFindMethodOptions()); File file = new File(getTestRoot() + "/results.txt"); assertEqualsToFile("", file, session.getClusters().toString()); }