void (@NotNull final CodeInsightTestFixture fixture, @TestDataFile @NotNull final String directoryName, @NotNull final String filesExtension) { EdtTestUtil.runInEdtAndWait(() -> { fixture.copyDirectoryToProject(directoryName, directoryName); fixture.configureByFile(directoryName + "/before." + filesExtension); int i = 1; while (true) { final String fileName = directoryName + "/after" + i + "." + filesExtension; if (new File(fixture.getTestDataPath() + "/" + fileName).exists()) { fixture.performEditorAction(IdeActions.ACTION_EDITOR_SELECT_WORD_AT_CARET); fixture.checkResultByFile(fileName); i++; } else { break; } } assertTrue("At least one 'after'-file required", i > 1); }); }