use of org.sonar.java.ast.parser.TreeFactory in project sonar-java by SonarSource.
the class EnumConstantTest method test_annotation.
@Test
public void test_annotation() {
LexerlessGrammarBuilder b = JavaLexer.createGrammarBuilder();
ActionParser<Tree> parser = new ActionParser<>(StandardCharsets.UTF_8, b, JavaGrammar.class, new TreeFactory(), new JavaNodeBuilder(), JavaLexer.ENUM_CONSTANT);
EnumConstantTreeImpl node = (EnumConstantTreeImpl) parser.parse("@Foo CONSTANT");
assertThat(node.modifiers().size()).isEqualTo(1);
assertThat(((IdentifierTree) ((AnnotationTreeImpl) node.modifiers().get(0)).annotationType()).identifierToken().text()).isEqualTo("Foo");
}
Aggregations