@Test void rowMapper() throws SQLException { when(resultSet.getInt("fred")).thenReturn(1034); when(resultSet.wasNull()).thenReturn(false); when(scope.database()).thenReturn(database); when(database.dialect()).thenReturn(dialect); when(dialect.type(DbTypeId.INTEGER)).thenReturn(new DefaultInteger()); when(database.getDataTypeOf(TypeToken.of(Integer.class))).thenReturn(DataType.INTEGER); OlapFunction<Integer> sut = new OlapFunction<>("foo", TypeToken.of(Integer.class), arg1); RowMapper<Integer> result = sut.rowMapper(scope, "fred"); assertThat(result.mapRow(resultSet), is(1034)); verifyNoMoreInteractions(resultSet); }
RowMapper<T> rowMapper(Scope scope, String label) { DataType<T> dataType = scope.database().getDataTypeOf(type); return rs -> dataType.get(rs, label, scope.database()).orElse(null); }
OlapFunction { RowMapper<T> rowMapper(Scope scope, String label) { DataType<T> dataType = scope.database().getDataTypeOf(type); return rs -> dataType.get(rs, label, scope.database()).orElse(null); } }
OlapFunction { RowMapper<T> rowMapper(Scope scope, String label) { DataType<T> dataType = scope.database().getDataTypeOf(type); return rs -> dataType.get(rs, label, scope.database()).orElse(null); } OlapFunction(String functionName, TypeToken<T> type, TypedExpression<?>... arguments); }
OlapFunction { RowMapper<T> rowMapper(Scope scope, String label) { DataType<T> dataType = scope.database().getDataTypeOf(type); return rs -> dataType.get(rs, label, scope.database()).orElse(null); } OlapFunction(String functionName, TypeToken<T> type, TypedExpression<?>... arguments);  }
OlapFunction { RowMapper<T> rowMapper(Scope scope, String label) { DataType<T> dataType = scope.database().getDataTypeOf(type); return rs -> dataType.get(rs, label, scope.database()).orElse(null); } OlapFunction(String functionName, TypeToken<T> type, TypedExpression<?>... arguments);   }