public AstNode rewrite(final AstNode node, final C context) {
    return rewriter.process(node, context);
  }
@Test
  public void shouldRewriteQueryWithPartitionBy() {
    // Given:
    final PartitionBy partitionBy = mock(PartitionBy.class);
    final PartitionBy rewrittenPartitionBy = mock(PartitionBy.class);

    final Query query =
        givenQuery(Optional.empty(), Optional.empty(), Optional.empty(), Optional.of(partitionBy),
            Optional.empty());

    when(mockRewriter.apply(partitionBy, context)).thenReturn(rewrittenPartitionBy);

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

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