void (@Nullable PsiFile psiFile, Collection<? extends HighlightInfo> infos, String text, @Nullable String filePath) { StringBuilder failMessage = new StringBuilder(); Set<HighlightInfo> expectedFound = CollectionFactory.createCustomHashingStrategySet(new HashingStrategy<>() { @Override public int hashCode(HighlightInfo object) { return object.hashCode(); } @Override public boolean equals(HighlightInfo o1, HighlightInfo o2) { return o1==null||o2==null?o1==o2:haveSamePresentation(o1, o2, true); } }); if (!myIgnoreExtraHighlighting) { Map<ExpectedHighlightingSet, Set<HighlightInfo>> indexed = new HashMap<>(); for (ExpectedHighlightingSet set : myHighlightingTypes.values()) { indexed.put(set, indexInfos(set.infos)); } for (HighlightInfo info : infos) { ThreeState state = expectedInfosContainsInfo(info, indexed); if (state == ThreeState.NO) { reportProblem(psiFile, failMessage, text, info, "extra "); failMessage.append(" [").append(info.type).append(']'); } else if (state == ThreeState.YES) { if (expectedFound.contains(info)) { if (isDuplicatedCheckDisabled) { //noinspection AssignmentToStaticFieldFromInstanceMethod failedDuplicationChecks++; } else { reportProblem(psiFile, failMessage, text, info, "duplicated "); } } expectedFound.add(info); } } } Set<HighlightInfo> indexedInfos = indexInfos(infos); Collection<ExpectedHighlightingSet> expectedHighlights = myHighlightingTypes.values(); for (ExpectedHighlightingSet highlightingSet : expectedHighlights) { Set<HighlightInfo> expInfos = highlightingSet.infos; for (HighlightInfo expectedInfo : expInfos) { if (!indexedInfos.contains(expectedInfo) && highlightingSet.enabled) { reportProblem(psiFile, failMessage, text, expectedInfo, "missing "); } } } if (failMessage.length() > 0) { if (filePath == null && psiFile != null) { VirtualFile file = psiFile.getVirtualFile(); if (file != null) { filePath = file.getUserData(VfsTestUtil.TEST_DATA_FILE_PATH); } } failMessage.append('\n'); compareTexts(infos, text, failMessage.toString(), filePath); } }