void (JavaCodeInsightTestFixture fixture, String fixName, String fileExtension, String testName) { String fileNameBefore = testName + '.' + fileExtension; String fileNameAfter = testName + "_after." + fileExtension; fixture.testHighlighting(fileNameBefore); IntentionAction intention = fixture.findSingleIntention(fixName); Path previewPath = Path.of(fixture.getTestDataPath(), testName + "_preview." + fileExtension); if (Files.exists(previewPath)) { String previewText = fixture.getIntentionPreviewText(intention); assertSameLinesWithFile(previewPath.toString(), previewText); fixture.launchAction(intention); } else { fixture.checkPreviewAndLaunchAction(intention); } fixture.checkResultByFile(fileNameBefore, fileNameAfter, true); }