@Test void toStringFunction() { when(expression.toString()).thenReturn("input"); CastBuilder<String> builder = new CastBuilder<>(expression); TypedExpression<String> sut = builder.asVarchar(20); String result = sut.toString(); assertThat(result, is("cast(input as varchar(20))")); verifyNoMoreInteractions(expression, scope, dialect, database, resultSet); }
@Override public String toString() { return String.format("cast(%s as %s)", from, toSql.apply(new AnsiDialect().type(toType), Database.newBuilder().build())); }
CastExpression implements TypedExpression<T> { @Override public String toString() { return String.format("cast(%s as %s)", from, toSql.apply(new AnsiDialect().type(toType), Database.newBuilder().build())); } }
CastExpression implements TypedExpression<T> { @Override public String toString() { return String.format("cast(%s as %s)", from, toSql.apply(new AnsiDialect().type(toType), Database.newBuilder().build())); } CastExpression(TypedExpression<F> from, DataType<T> to, DbTypeId<T> toType, BiFunction<DbType<T>,Database,String> toSql); }
CastExpression implements TypedExpression<T> { @Override public String toString() { return String.format("cast(%s as %s)", from, toSql.apply(new AnsiDialect().type(toType), Database.newBuilder().build())); } CastExpression(TypedExpression<F> from, DataType<T> to, DbTypeId<T> toType, BiFunction<DbType<T>,Database,String> toSql); @Override String label(Scope scope); @Override RowMapper<T> rowMapper(Scope scope, Optional<String> label); @Override TypeToken<T> type(); @Override String sql(Scope scope); @Override Stream<Object> args(Scope scope); @Override Precedence precedence(); @Override String toString(); }
CastExpression implements TypedExpression<T> { @Override public String toString() { return String.format("cast(%s as %s)", from, toSql.apply(new AnsiDialect().type(toType), Database.newBuilder().build())); } CastExpression(TypedExpression<F> from, DataType<T> to, DbTypeId<T> toType, BiFunction<DbType<T>,Database,String> toSql); @Override String label(Scope scope); @Override RowMapper<T> rowMapper(Scope scope, Optional<String> label); @Override TypeToken<T> type(); @Override String sql(Scope scope); @Override Stream<Object> args(Scope scope); @Override Precedence precedence(); @Override String toString();  }