void (@NotNull String expectedFile, boolean stripTrailingSpaces, @NotNull SelectionAndCaretMarkupLoader loader, @NotNull String actualText) { assertInitialized(); Project project = getProject(); Editor editor = getEditor(); if (editor instanceof EditorWindow) { editor = ((EditorWindow)editor).getDelegate(); } UsefulTestCase.doPostponedFormatting(getProject()); if (stripTrailingSpaces) { actualText = stripTrailingSpaces(actualText); } PsiDocumentManager.getInstance(project).commitAllDocuments(); String expectedText = loader.newFileText; if (stripTrailingSpaces) { expectedText = stripTrailingSpaces(expectedText); } actualText = StringUtil.convertLineSeparators(actualText); if (!Objects.equals(expectedText, actualText)) { if (loader.filePath == null) { throw new ComparisonFailure(expectedFile, expectedText, actualText); } if (loader.caretState.hasExplicitCaret()) { int offset = editor.getCaretModel().getOffset(); if (offset > -1) { if (offset > actualText.length()) actualText += StringUtil.repeat(" ", offset - actualText.length()); actualText = new StringBuilder(actualText).insert(offset, "<caret>").toString(); } expectedText = loader.fileText; if (stripTrailingSpaces) { expectedText = stripTrailingSpaces(expectedText); } } throw new FileComparisonFailure(expectedFile, expectedText, actualText, loader.filePath); } EditorTestUtil.verifyCaretAndSelectionState(editor, loader.caretState, expectedFile, loader.filePath); }