public static String formatSql(final AstNode root) {
    final StringBuilder builder = new StringBuilder();
    new Formatter(builder).process(root, 0);
    return StringUtils.stripEnd(builder.toString(), "\n");
  }
@Test
  public void shouldFormatCsasWithClause() {
    final String statementString = "CREATE STREAM S WITH(partitions=4) AS SELECT * FROM address;";
    final Statement statement = parseSingle(statementString);

    final String result = SqlFormatter.formatSql(statement);

    assertThat(result, startsWith("CREATE STREAM S WITH (PARTITIONS=4) AS SELECT"));
  }