@Test void args() { CaseExpression<String> sut = new CaseExpression<>(condition, expression1); when(condition.args(scope)).thenReturn(Stream.of(1, "2")); when(expression1.args(scope)).thenReturn(Stream.of(3.0, BigDecimal.TEN)); Object[] args = sut.args(scope).toArray(); assertThat(args, arrayContaining(1, "2", 3.0, BigDecimal.TEN)); verifyNoMoreInteractions(condition, expression1, scope); }
@Override public Stream<Object> args(Scope scope) { return Stream.concat( cases.stream().flatMap(c -> Stream.concat(c.item1().args(scope), c.item2().args(scope))), StreamUtil.of(orElse).flatMap(e -> e.args(scope)) ); }
CaseExpression implements TypedExpression<T> { @Override public Stream<Object> args(Scope scope) { return Stream.concat( cases.stream().flatMap(c -> Stream.concat(c.item1().args(scope), c.item2().args(scope))), StreamUtil.of(orElse).flatMap(e -> e.args(scope)) ); } }
CaseExpression implements TypedExpression<T> { @Override public Stream<Object> args(Scope scope) { return Stream.concat( cases.stream().flatMap(c -> Stream.concat(c.item1().args(scope), c.item2().args(scope))), StreamUtil.of(orElse).flatMap(e -> e.args(scope)) ); } CaseExpression(BooleanExpression booleanExpression, TypedExpression<T> value); }
CaseExpression implements TypedExpression<T> { @Override public Stream<Object> args(Scope scope) { return Stream.concat( cases.stream().flatMap(c -> Stream.concat(c.item1().args(scope), c.item2().args(scope))), StreamUtil.of(orElse).flatMap(e -> e.args(scope)) ); } CaseExpression(BooleanExpression booleanExpression, TypedExpression<T> value); @Override String sql(Scope scope); @Override Stream<Object> args(Scope scope); @Override Precedence precedence(); @Override String label(Scope scope); @Override RowMapper<T> rowMapper(Scope scope, Optional<String> label); @Override TypeToken<T> type(); TypedExpression<T> orElse(T value); TypedExpression<T> orElse(TypedExpression<T> value); TypedExpression<T> orElse(Function1<R,T> method); TypedExpression<T> orElse(FunctionOptional1<R,T> method); TypedExpression<T> orElse(String alias, Function1<R,T> method); TypedExpression<T> orElse(String alias, FunctionOptional1<R,T> method); TypedExpression<T> orElse(Alias<R> alias, Function1<R,T> method); TypedExpression<T> orElse(Alias<R> alias, FunctionOptional1<R,T> method); ExpressionBuilder<X,InSubsequentWhenExpectingThen> when(X val); ExpressionBuilder<X,InSubsequentWhenExpectingThen> when(TypedExpression<X> expression); ExpressionBuilder<R,InSubsequentWhenExpectingThen> when(Function1<X,R> method); ExpressionBuilder<R,InSubsequentWhenExpectingThen> when(FunctionOptional1<X,R> method); ExpressionBuilder<R,InSubsequentWhenExpectingThen> when(String alias, Function1<X,R> method); ExpressionBuilder<R,InSubsequentWhenExpectingThen> when(String alias, FunctionOptional1<X,R> method); ExpressionBuilder<R,InSubsequentWhenExpectingThen> when(Alias<X> alias, Function1<X,R> method); ExpressionBuilder<R,InSubsequentWhenExpectingThen> when(Alias<X> alias, FunctionOptional1<X,R> method); }
CaseExpression implements TypedExpression<T> { @Override public Stream<Object> args(Scope scope) { return Stream.concat( cases.stream().flatMap(c -> Stream.concat(c.item1().args(scope), c.item2().args(scope))), StreamUtil.of(orElse).flatMap(e -> e.args(scope)) ); } CaseExpression(BooleanExpression booleanExpression, TypedExpression<T> value); @Override String sql(Scope scope); @Override Stream<Object> args(Scope scope); @Override Precedence precedence(); @Override String label(Scope scope); @Override RowMapper<T> rowMapper(Scope scope, Optional<String> label); @Override TypeToken<T> type(); TypedExpression<T> orElse(T value); TypedExpression<T> orElse(TypedExpression<T> value); TypedExpression<T> orElse(Function1<R,T> method); TypedExpression<T> orElse(FunctionOptional1<R,T> method); TypedExpression<T> orElse(String alias, Function1<R,T> method); TypedExpression<T> orElse(String alias, FunctionOptional1<R,T> method); TypedExpression<T> orElse(Alias<R> alias, Function1<R,T> method); TypedExpression<T> orElse(Alias<R> alias, FunctionOptional1<R,T> method); ExpressionBuilder<X,InSubsequentWhenExpectingThen> when(X val); ExpressionBuilder<X,InSubsequentWhenExpectingThen> when(TypedExpression<X> expression); ExpressionBuilder<R,InSubsequentWhenExpectingThen> when(Function1<X,R> method); ExpressionBuilder<R,InSubsequentWhenExpectingThen> when(FunctionOptional1<X,R> method); ExpressionBuilder<R,InSubsequentWhenExpectingThen> when(String alias, Function1<X,R> method); ExpressionBuilder<R,InSubsequentWhenExpectingThen> when(String alias, FunctionOptional1<X,R> method); ExpressionBuilder<R,InSubsequentWhenExpectingThen> when(Alias<X> alias, Function1<X,R> method); ExpressionBuilder<R,InSubsequentWhenExpectingThen> when(Alias<X> alias, FunctionOptional1<X,R> method);  }