@Test void sql() { SelectStatement<Integer> sut = new SelectStatement<>(createScope(), TypeToken.of(Integer.class), from, rowMapper, projection); when(projection.sql(any())).thenReturn("*"); when(from.sql(any())).thenReturn(" from foo"); when(booleanExpression1.sql(any())).thenReturn("1 = 2"); when(booleanExpression1.precedence()).thenReturn(Precedence.COMPARISON); sut.setWhereClause(booleanExpression1); sut.addGroupBy(TypedExpression.literal("ABC")); sut.addOrderBy(1, Order.DESC); String result = sut.sql(); assertThat(result, is("select * from foo where 1 = 2 group by 'ABC' order by 1 desc")); }
String sql(Scope outerScope) { return "(" + sqlImpl(outerScope) + ")"; }
SelectStatement { String sql(Scope outerScope) { return "(" + sqlImpl(outerScope) + ")"; } }
SelectStatement { String sql(Scope outerScope) { return "(" + sqlImpl(outerScope) + ")"; } SelectStatement(Scope scope, TypeToken<RT> rowType, From from, RowMapper<RT> rowMapper, Projection projection); }
SelectStatement { String sql(Scope outerScope) { return "(" + sqlImpl(outerScope) + ")"; } SelectStatement(Scope scope, TypeToken<RT> rowType, From from, RowMapper<RT> rowMapper, Projection projection); TypeToken<RT> rowType(); Stream<CommonTableExpression<?>> commonTableExpressions(); }
SelectStatement { String sql(Scope outerScope) { return "(" + sqlImpl(outerScope) + ")"; } SelectStatement(Scope scope, TypeToken<RT> rowType, From from, RowMapper<RT> rowMapper, Projection projection); TypeToken<RT> rowType(); Stream<CommonTableExpression<?>> commonTableExpressions();  }