void (@Nullable PsiFile psiFile, @NotNull Collection<? extends LineMarkerInfo> markerInfos, @NotNull String text) { String fileName = psiFile == null ? "" : psiFile.getName() + ": "; StringBuilder failMessage = new StringBuilder(); for (LineMarkerInfo info : markerInfos) { if (!containsLineMarker(info, myLineMarkerInfos.values())) { if (failMessage.length() > 0) failMessage.append('\n'); failMessage.append(fileName).append("extra ") .append(rangeString(text, info.startOffset, info.endOffset)) .append(": '").append(sanitizedLineMarkerTooltip(info)).append('\''); Icon icon = info.getIcon(); if (icon != null && !icon.toString().equals(ANY_TEXT)) { failMessage.append(" icon='").append(icon).append('\''); } } } for (LineMarkerInfo expectedLineMarker : myLineMarkerInfos.values()) { if (markerInfos.isEmpty() || !containsLineMarker(expectedLineMarker, markerInfos)) { if (failMessage.length() > 0) failMessage.append('\n'); failMessage.append(fileName).append("missing ") .append(rangeString(text, expectedLineMarker.startOffset, expectedLineMarker.endOffset)) .append(": '").append(sanitizedLineMarkerTooltip(expectedLineMarker)).append('\''); Icon icon = expectedLineMarker.getIcon(); if (icon != null && !icon.toString().equals(ANY_TEXT)) { failMessage.append(" icon='").append(icon).append('\''); } } } if (failMessage.length() > 0) { String filePath = null; if (psiFile != null) { VirtualFile file = psiFile.getVirtualFile(); if (file != null) { filePath = file.getUserData(VfsTestUtil.TEST_DATA_FILE_PATH); } } throw new FileComparisonFailure(failMessage.toString(), myText, getActualLineMarkerFileText(markerInfos), filePath); } }