private static boolean infoEquals(HighlightInfo expectedInfo, HighlightInfo info) { if (expectedInfo == info) return true; return info.getSeverity() == expectedInfo.getSeverity() && info.startOffset == expectedInfo.startOffset && info.endOffset == expectedInfo.endOffset && info.isAfterEndOfLine() == expectedInfo.isAfterEndOfLine() && (expectedInfo.type == WHATEVER || expectedInfo.type.equals(info.type)) && (Comparing.strEqual(ANY_TEXT, expectedInfo.getDescription()) || Comparing.strEqual(info.getDescription(), expectedInfo.getDescription())) && (expectedInfo.forcedTextAttributes == null || Comparing.equal( expectedInfo.getTextAttributes(null, null), info.getTextAttributes(null, null))) && (expectedInfo.forcedTextAttributesKey == null || expectedInfo.forcedTextAttributesKey.equals(info.forcedTextAttributesKey)); }
private boolean expectedInfosContainsInfo(HighlightInfo info) { if (info.getTextAttributes(null, null) == TextAttributes.ERASE_MARKER) return true; final Collection<ExpectedHighlightingSet> expectedHighlights = myHighlightingTypes.values(); for (ExpectedHighlightingSet highlightingSet : expectedHighlights) { if (highlightingSet.severity != info.getSeverity()) continue; if (!highlightingSet.enabled) return true; final Set<HighlightInfo> infos = highlightingSet.infos; for (HighlightInfo expectedInfo : infos) { if (infoEquals(expectedInfo, info)) { return true; } } } return false; }