QuickFixTestCase (final String testDataPath) { return new QuickFixTestCase() { String myTestDataPath = testDataPath; @Override public String getBasePath() { return LightQuickFixTestCase.this.getBasePath(); } @NotNull @Override public String getTestDataPath() { if (myTestDataPath == null) { myTestDataPath = LightQuickFixTestCase.this.getTestDataPath(); } return myTestDataPath; } @NotNull @Override public ActionHint parseActionHintImpl(@NotNull PsiFile file, @NotNull String contents) { return LightQuickFixTestCase.this.parseActionHintImpl(file, contents); } @Override public void beforeActionStarted(@NotNull String testName, @NotNull String contents) { LightQuickFixTestCase.this.beforeActionStarted(testName, contents); } @Override public void afterActionCompleted(@NotNull String testName, @NotNull String contents) { LightQuickFixTestCase.this.afterActionCompleted(testName, contents); } @Override public void doAction(@NotNull ActionHint actionHint, @NotNull String testFullPath, @NotNull String testName) throws Exception { LightQuickFixTestCase.this.doAction(actionHint, testFullPath, testName); } @Override public void checkResultByFile(@NotNull String message, @NotNull String expectedFilePath, boolean ignoreTrailingSpaces) { LightQuickFixTestCase.this.checkResultByFile(message, expectedFilePath, ignoreTrailingSpaces); } @Override public IntentionAction findActionWithText(@NotNull String text) { return LightQuickFixTestCase.this.findActionWithText(text); } @Override public boolean shouldBeAvailableAfterExecution() { return LightQuickFixTestCase.this.shouldBeAvailableAfterExecution(); } @Override public void invoke(@NotNull IntentionAction action) { LightQuickFixTestCase.this.invoke(action); } @Override public void checkPreviewAndInvoke(@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); } } @NotNull @Override public List<HighlightInfo> doHighlighting() { return LightQuickFixTestCase.this.doHighlighting(); } @NotNull @Override public List<IntentionAction> getAvailableActions() { return LightQuickFixTestCase.this.getAvailableActions(); } @Override public void configureFromFileText(@NotNull String name, @NotNull String contents) { LightQuickFixTestCase.this.configureFromFileText(name, contents, true); } @Override public PsiFile getFile() { return LightQuickFixTestCase.this.getFile(); } @Override public Project getProject() { return LightQuickFixTestCase.this.getProject(); } @Override public void bringRealEditorBack() { LightQuickFixTestCase.this.bringRealEditorBack(); } }; }