@Test void sql() { when(expression1.sql(scope)).thenReturn("sql1"); when(expression2.sql(scope)).thenReturn("sql2"); CoalesceFunction<String> sut = coalesce(expression1).orElse(expression2); String result = sut.sql(scope); assertThat(result, is("coalesce(sql1, sql2)")); verify(expression1).sql(scope); verify(expression2).sql(scope); verifyNoMoreInteractions(expression1, expression2); }
@Override public String sql(Scope scope) { return String.format("coalesce(%s)", terms.stream().map(t -> t.sql(scope)).collect(joining(", "))); }
CoalesceFunction implements TypedExpression<T> { @Override public String sql(Scope scope) { return String.format("coalesce(%s)", terms.stream().map(t -> t.sql(scope)).collect(joining(", "))); } }
CoalesceFunction implements TypedExpression<T> { @Override public String sql(Scope scope) { return String.format("coalesce(%s)", terms.stream().map(t -> t.sql(scope)).collect(joining(", "))); } private  CoalesceFunction(TypedExpression<T> expression); }
CoalesceFunction implements TypedExpression<T> { @Override public String sql(Scope scope) { return String.format("coalesce(%s)", terms.stream().map(t -> t.sql(scope)).collect(joining(", "))); } private  CoalesceFunction(TypedExpression<T> expression); @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(); @NotNull CoalesceFunction<T> orElse(T value); @NotNull CoalesceFunction<T> orElse(TypedExpression<T> expression); @NotNull CoalesceFunction<T> orElse(Function1<R,T> methodReference); @NotNull CoalesceFunction<T> orElse(FunctionOptional1<R,T> methodReference); @NotNull CoalesceFunction<T> orElse(String alias, Function1<R,T> methodReference); @NotNull CoalesceFunction<T> orElse(String alias, FunctionOptional1<R,T> methodReference); @NotNull CoalesceFunction<T> orElse(Alias<R> alias, Function1<R,T> methodReference); @NotNull CoalesceFunction<T> orElse(Alias<R> alias, FunctionOptional1<R,T> methodReference); @NotNull static CoalesceFunction<T> coalesce(TypedExpression<T> expression); @NotNull static CoalesceFunction<T> coalesce(Function1<R,T> methodReference); @NotNull static CoalesceFunction<T> coalesce(FunctionOptional1<R,T> methodReference); @NotNull static CoalesceFunction<T> coalesce(String alias, Function1<R,T> methodReference); @NotNull static CoalesceFunction<T> coalesce(String alias, FunctionOptional1<R,T> methodReference); @NotNull static CoalesceFunction<T> coalesce(Alias<R> alias, Function1<R,T> methodReference); @NotNull static CoalesceFunction<T> coalesce(Alias<R> alias, FunctionOptional1<R,T> methodReference); }
CoalesceFunction implements TypedExpression<T> { @Override public String sql(Scope scope) { return String.format("coalesce(%s)", terms.stream().map(t -> t.sql(scope)).collect(joining(", "))); } private  CoalesceFunction(TypedExpression<T> expression); @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(); @NotNull CoalesceFunction<T> orElse(T value); @NotNull CoalesceFunction<T> orElse(TypedExpression<T> expression); @NotNull CoalesceFunction<T> orElse(Function1<R,T> methodReference); @NotNull CoalesceFunction<T> orElse(FunctionOptional1<R,T> methodReference); @NotNull CoalesceFunction<T> orElse(String alias, Function1<R,T> methodReference); @NotNull CoalesceFunction<T> orElse(String alias, FunctionOptional1<R,T> methodReference); @NotNull CoalesceFunction<T> orElse(Alias<R> alias, Function1<R,T> methodReference); @NotNull CoalesceFunction<T> orElse(Alias<R> alias, FunctionOptional1<R,T> methodReference); @NotNull static CoalesceFunction<T> coalesce(TypedExpression<T> expression); @NotNull static CoalesceFunction<T> coalesce(Function1<R,T> methodReference); @NotNull static CoalesceFunction<T> coalesce(FunctionOptional1<R,T> methodReference); @NotNull static CoalesceFunction<T> coalesce(String alias, Function1<R,T> methodReference); @NotNull static CoalesceFunction<T> coalesce(String alias, FunctionOptional1<R,T> methodReference); @NotNull static CoalesceFunction<T> coalesce(Alias<R> alias, Function1<R,T> methodReference); @NotNull static CoalesceFunction<T> coalesce(Alias<R> alias, FunctionOptional1<R,T> methodReference);  }