public AstNode rewrite(final AstNode node, final C context) {
    return rewriter.process(node, context);
  }
@Test
  public void shouldRewriteQueryWithGroupBy() {
    // Given:
    final GroupBy groupBy = mock(GroupBy.class);
    final GroupBy rewrittenGroupBy = mock(GroupBy.class);
    final Query query =
        givenQuery(Optional.empty(), Optional.empty(), Optional.of(groupBy), Optional.empty(), Optional.empty());
    when(mockRewriter.apply(groupBy, context)).thenReturn(rewrittenGroupBy);

    // When:
    final AstNode rewritten = rewriter.rewrite(query, context);

    // Then:
    assertThat(rewritten, equalTo(new Query(
        location,
        rewrittenSelect,
        rewrittenRelation,
        Optional.empty(),
        Optional.empty(),
        Optional.of(rewrittenGroupBy),
        Optional.empty(),
        Optional.empty(),
        Optional.of(refinementInfo),
        false,
        optionalInt))
    );
  }