use of org.sonar.plugins.java.api.tree.ExpressionStatementTree in project sonar-java by SonarSource.
the class SyntaxTreeNameFinderTest method testClassCast.
@Test
public void testClassCast() {
MethodTree tree = buildSyntaxTree("public boolean equals(Object obj) {((String) obj).length;}");
BlockTree block = tree.block();
StatementTree statementTree = block.body().get(0);
MemberSelectExpressionTree mse = (MemberSelectExpressionTree) ((ExpressionStatementTree) statementTree).expression();
assertThat(SyntaxTreeNameFinder.getName(mse)).isEqualTo("obj");
}
Aggregations