SmaliSyntaxHighlighter extends SyntaxHighlighterBase { @Override @NotNull public TextAttributesKey[] getTokenHighlights(IElementType tokenType) { if (KEYWORD_TOKENS.contains(tokenType) || ACCESS_MODIFIER_TOKENS.contains(tokenType)) { return KEYWORD_ATTR_KEYS; } if (COMMENT_TOKENS.contains(tokenType)) { return COMMENT_ATTR_KEYS; } if (tokenType.equals(JAVA_IDENTIFIER)) { return JAVA_IDENTIFIER_ATTR_KEYS; } if (STRING_TOKENS.contains(tokenType)) { return STRING_ATTR_KEYS; } if (NUMBER_TOKENS.contains(tokenType)) { return NUMBER_ATTR_KEYS; } if (BRACES_TOKENS.contains(tokenType)) { return BRACES_ATTR_KEYS; } if (PARENTHESES_TOKENS.contains(tokenType)) { return PARENTHESES_ATTR_KEYS; } return EMPTY_KEYS; }  @Override @NotNull Lexer getHighlightingLexer(); @Override @NotNull TextAttributesKey[] getTokenHighlights(IElementType tokenType);  }
@Test public void getTokenHighlightsWithKeywordTokens() throws Exception { for (IElementType tokenType : KEYWORD_TOKENS.getTypes()) { assertSame(KEYWORD_ATTR_KEYS, myHighlighter.getTokenHighlights(tokenType)); } }
@Test public void getTokenHighlightsWithAccessModifiersTokens() throws Exception { for (IElementType tokenType : ACCESS_MODIFIER_TOKENS.getTypes()) { assertSame(KEYWORD_ATTR_KEYS, myHighlighter.getTokenHighlights(tokenType)); } }
@Test public void getTokenHighlightsWithJavaIdentifierToken() throws Exception { assertSame(JAVA_IDENTIFIER_ATTR_KEYS, myHighlighter.getTokenHighlights(JAVA_IDENTIFIER)); }
@Test public void getTokenHighlightsWithStringTokens() throws Exception { for (IElementType tokenType : STRING_TOKENS.getTypes()) { assertSame(STRING_ATTR_KEYS, myHighlighter.getTokenHighlights(tokenType)); } }
@Test public void getTokenHighlightsWithNumberTokens() throws Exception { for (IElementType tokenType : NUMBER_TOKENS.getTypes()) { assertSame(NUMBER_ATTR_KEYS, myHighlighter.getTokenHighlights(tokenType)); } }
@Test public void getTokenHighlightsWithBracesTokens() throws Exception { for (IElementType tokenType : BRACES_TOKENS.getTypes()) { assertSame(BRACES_ATTR_KEYS, myHighlighter.getTokenHighlights(tokenType)); } }
@Test public void getTokenHighlightsWithParenthesisTokens() throws Exception { for (IElementType tokenType : PARENTHESES_TOKENS.getTypes()) { assertSame(PARENTHESES_ATTR_KEYS, myHighlighter.getTokenHighlights(tokenType)); } }
@Test public void getTokenHighlightsWithUnrecognizedTokens() throws Exception { assertSame(EMPTY_KEYS, myHighlighter.getTokenHighlights(mock(IElementType.class))); }