protected void doLexerHighlightingTest(String fileContent, IElementType targetElementType) { BashSyntaxHighlighter syntaxHighlighter = new BashSyntaxHighlighter(); TextAttributesKey[] keys = syntaxHighlighter.getTokenHighlights(targetElementType); Assert.assertEquals("Expected one key", 1, keys.length); TextAttributesKey attributesKey = keys[0]; Assert.assertNotNull(attributesKey); EditorColorsManager manager = EditorColorsManager.getInstance(); EditorColorsScheme scheme = (EditorColorsScheme) manager.getGlobalScheme().clone(); manager.addColorsScheme(scheme); EditorColorsManager.getInstance().setGlobalScheme(scheme); TextAttributes targetAttributes = new TextAttributes(JBColor.RED, JBColor.BLUE, JBColor.GRAY, EffectType.BOXED, Font.BOLD); scheme.setAttributes(attributesKey, targetAttributes); myFixture.configureByText(BashFileType.BASH_FILE_TYPE, fileContent); TextAttributes actualAttributes = null; HighlighterIterator iterator = ((EditorImpl) myFixture.getEditor()).getHighlighter().createIterator(0); while (!iterator.atEnd()) { if (iterator.getTokenType() == targetElementType) { actualAttributes = iterator.getTextAttributes(); break; } iterator.advance(); } Assert.assertEquals("Expected text attributes for " + attributesKey, targetAttributes, actualAttributes); }