void (Editor editor, CaretAndSelectionState caretState, String message, String expectedFilePath) { boolean hasChecks = false; for (int i = 0; i < caretState.carets.size(); i++) { EditorTestUtil.CaretInfo expected = caretState.carets.get(i); if (expected.position != null || expected.selection != null) { hasChecks = true; break; } } if (!hasChecks) { return; // nothing to check, so we skip caret/selection assertions } try { doVerifyCaretAndSelectionState(editor, caretState, message); } catch (AssertionError e) { try { String expected = CaretAndSelectionMarkup.renderExpectedState(editor, caretState.carets); String actual = CaretAndSelectionMarkup.renderActualState(editor); if (expectedFilePath != null) { if (!expected.equals(actual)) { throw new FileComparisonFailure(e.getMessage(), expected, actual, expectedFilePath); } } else { assertEquals(e.getMessage(), expected, actual); } } catch (AssertionError exception) { exception.addSuppressed(e); throw exception; } throw e; } }