void (@NotNull String fileName, @NotNull String text, boolean isRainbowOn, boolean withColor) { EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme(); boolean isRainbowOnInScheme = RainbowHighlighter.isRainbowEnabled(globalScheme, null); try { RainbowHighlighter.setRainbowEnabled(globalScheme, null, isRainbowOn); configureByText(fileName, text.replaceAll("<" + RAINBOW + "(\\scolor='[^']*')?>", "").replace("</" + RAINBOW + ">", "")); List<HighlightInfo> highlighting = ContainerUtil.filter(doHighlighting(), info -> info.type == RainbowHighlighter.RAINBOW_ELEMENT); assertEquals(text, getTagsFromSegments(editor.getDocument().getText(), highlighting, RAINBOW, highlightInfo -> { if (!withColor) { return null; } TextAttributes attributes = highlightInfo.getTextAttributes(null, null); String color = attributes == null ? "null" : attributes.getForegroundColor() == null ? "null" : Integer.toHexString(attributes.getForegroundColor().getRGB()); return "color='" + color + "'"; })); } finally { RainbowHighlighter.setRainbowEnabled(globalScheme, null, isRainbowOnInScheme); } }