use of org.sonar.plugins.java.api.tree.ContinueStatementTree in project sonar-java by SonarSource.
the class JavaTreeModelTest method continue_statement.
/**
* 14.16. The continue Statement
*/
@Test
public void continue_statement() {
ContinueStatementTree tree = (ContinueStatementTree) firstMethodFirstStatement("class T { void m() { continue ; } }");
assertThat(tree.is(Tree.Kind.CONTINUE_STATEMENT)).isTrue();
assertThat(tree.continueKeyword().text()).isEqualTo("continue");
assertThat(tree.label()).isNull();
assertThat(tree.semicolonToken().text()).isEqualTo(";");
assertThatChildrenIteratorHasSize(tree, 2);
tree = (ContinueStatementTree) firstMethodFirstStatement("class T { void m() { continue label ; } }");
assertThat(tree.is(Tree.Kind.CONTINUE_STATEMENT)).isTrue();
assertThat(tree.continueKeyword().text()).isEqualTo("continue");
assertThat(tree.label().name()).isEqualTo("label");
assertThat(tree.semicolonToken().text()).isEqualTo(";");
assertThatChildrenIteratorHasSize(tree, 3);
}
Aggregations