@Test void cteArgs() { SelectStatement<Integer> sut = new SelectStatement<>(createScope(), TypeToken.of(Integer.class), from, rowMapper, projection); when(projection.args(any())).thenReturn(Stream.of("ABC")); when(from.args(any())).thenReturn(Stream.of(1, 2.4)); when(cte.args(any())).thenReturn(Stream.of("Foo", "Bar")); sut.addCommonTableExpression(cte); Stream<Object> result = sut.args(sut.scope()); assertThat(result.toArray(), arrayContaining("Foo", "Bar", "ABC", 1, 2.4)); }
@NotNull private Stream<Object> cteArgs(Scope actualScope) { return actualScope.isOutermost() ? commonTableExpressions().flatMap(cte -> cte.args(actualScope)) : Stream.empty(); }
SelectStatement { @NotNull private Stream<Object> cteArgs(Scope actualScope) { return actualScope.isOutermost() ? commonTableExpressions().flatMap(cte -> cte.args(actualScope)) : Stream.empty(); } }
SelectStatement { @NotNull private Stream<Object> cteArgs(Scope actualScope) { return actualScope.isOutermost() ? commonTableExpressions().flatMap(cte -> cte.args(actualScope)) : Stream.empty(); } SelectStatement(Scope scope, TypeToken<RT> rowType, From from, RowMapper<RT> rowMapper, Projection projection); }
SelectStatement { @NotNull private Stream<Object> cteArgs(Scope actualScope) { return actualScope.isOutermost() ? commonTableExpressions().flatMap(cte -> cte.args(actualScope)) : Stream.empty(); } SelectStatement(Scope scope, TypeToken<RT> rowType, From from, RowMapper<RT> rowMapper, Projection projection); TypeToken<RT> rowType(); Stream<CommonTableExpression<?>> commonTableExpressions(); }
SelectStatement { @NotNull private Stream<Object> cteArgs(Scope actualScope) { return actualScope.isOutermost() ? commonTableExpressions().flatMap(cte -> cte.args(actualScope)) : Stream.empty(); } SelectStatement(Scope scope, TypeToken<RT> rowType, From from, RowMapper<RT> rowMapper, Projection projection); TypeToken<RT> rowType(); Stream<CommonTableExpression<?>> commonTableExpressions();  }