コード例 #1
0
  @Test
  public void test_nextSibling() {
    assertThat((Object) select.nextSibling()).isSameAs(AstSelectFactory.empty());

    AstNode sibling = mock(AstNode.class);
    when(node.getNextSibling()).thenReturn(sibling);
    assertThat((Object) select.nextSibling()).isInstanceOf(SingleAstSelect.class);
    assertThat(select.nextSibling()).containsOnly(sibling);
  }
コード例 #2
0
  // XXX may go to a utility class
  private String getOperatorId(AstNode operatorFunctionId) {

    StringBuilder builder = new StringBuilder(operatorFunctionId.getTokenValue());
    AstNode operator = operatorFunctionId.getFirstDescendant(CxxGrammarImpl.operator);

    if (operator != null) {

      AstNode opNode = operator.getFirstChild();
      while (opNode != null) {
        builder.append(opNode.getTokenValue());
        opNode = opNode.getNextSibling();
      }
    }

    return builder.toString();
  }