GroupByImpl extends BaseFinishedSelectStatement implements GroupBy { @Override public void prependTo(@NotNull final RawSqlBuilder builder) { builder.prepend(mExpression).prepend("GROUP BY "); } GroupByImpl(@NotNull final String expression, @NotNull final SqlPart previous); @NotNull @Override OrderBy orderBy(@NotNull final String... terms); @NotNull @Override Limit limit(final long limit); @Override void prependTo(@NotNull final RawSqlBuilder builder); @Nullable @Override SqlPart previous();  }
@Test public void prependTo_prependsProperSql() { GroupByImpl groupBy = new GroupByImpl("a", mock(SqlPart.class)); RawSqlBuilder builder = new RawSqlBuilderImpl(); groupBy.prependTo(builder); assertThat(builder.toString(), is("GROUP BY a")); }