GroupNode (int[] indices, UsageGroupingRule[] rules) { List<Usage> usages = IntStream.of(indices).mapToObj(UsageNodeTreeBuilderTest::createUsage).collect(Collectors.toList()); UsageViewPresentation presentation = new UsageViewPresentation(); presentation.setUsagesString("searching for mock usages"); ExtensionPoint<UsageGroupingRuleProvider> point = UsageGroupingRuleProvider.EP_NAME.getPoint(); UsageGroupingRuleProvider provider = new UsageGroupingRuleProvider() { @Override public @NotNull UsageGroupingRule @NotNull [] getActiveRules(@NotNull Project project) { return rules; } }; Disposable disposable = Disposer.newDisposable(); point.registerExtension(provider, disposable); try { UsageViewImpl usageView = new UsageViewImpl(getProject(), presentation, UsageTarget.EMPTY_ARRAY, null); Disposer.register(getTestRootDisposable(), usageView); usageView.appendUsagesInBulk(usages); UIUtil.dispatchAllInvocationEvents(); ProgressManager.getInstance().run(new Task.Modal(getProject(), "Waiting", false) { @Override public void run(@NotNull ProgressIndicator indicator) { usageView.waitForUpdateRequestsCompletion(); } }); UIUtil.dispatchAllInvocationEvents(); return usageView.getRoot(); } finally { Disposer.dispose(disposable); } }