void (@NotNull BooleanSupplier isInsideResolve, @NotNull Runnable runnable) { ThreadingAssertions.assertEventDispatchThread(); AtomicBoolean resolveHappened = new AtomicBoolean(); // we run the test in EDT under this fake progress which is needed for one thing only: to be able to assert that no resolve happens in EDT. // Since resolve calls checkCanceled() a lot, we intercept these calls and check is we are being called from outside of EDT class MyPingProgressIndicator extends ProgressIndicatorBase implements PingProgress { @Override public void interact() { if (resolveHappened.get() && (!ApplicationManager.getApplication().isDispatchThread() && ApplicationManager.getApplication().isReadAccessAllowed() || ApplicationManager.getApplication().isWriteAccessAllowed())) { return; // optimization: try not to call getStackTrace() if we can } boolean isFromResolve = isInsideResolve.getAsBoolean(); ; if (isFromResolve) resolveHappened.set(true); assertTrue("Resolve in EDT happened", !isFromResolve || !ApplicationManager.getApplication().isDispatchThread() && ApplicationManager.getApplication().isReadAccessAllowed() // allow resolve from the background thread || ApplicationManager.getApplication().isWriteAccessAllowed()); // allow resolve in the write action because that's how PsiReference.bindToElement() works } } ProgressManager.getInstance().executeProcessUnderProgress(runnable, new MyPingProgressIndicator()); assertTrue("It seems there wasn't any resolve in this test at all. (or maybe `isFromJavaCodeReferenceElementResolve()` method is broken?)", resolveHappened.get()); }