void (@NotNull IntentionAction action, @NotNull String previewFilePath) { // Run in background thread to catch accidental write-actions during preview generation String previewContent; try { previewContent = ReadAction.nonBlocking( () -> IntentionPreviewPopupUpdateProcessor.getPreviewContent(getProject(), action, getFile(), getEditor())) .submit(AppExecutorUtil.getAppExecutorService()).get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } LightQuickFixTestCase.this.invoke(action); NonBlockingReadActionImpl.waitForAsyncTaskCompletion(); Path path = Path.of(getTestDataPath(), previewFilePath); if (Files.exists(path)) { assertSameLinesWithFile(path.toString(), previewContent); } else { if (previewContent.isEmpty()) { fail("No preview was generated for '" + action.getText() + "'"); } assertEquals(getFile().getText(), previewContent); } }