@Test void should_create_stock_when_invoked_given_valid_driver_row() { var i = Instant.parse("2019-01-01T12:34:56.789Z"); BigDecimal value = BigDecimal.valueOf(42); given(row.getString(SYMBOL)).willReturn("ABC"); given(row.getInstant(DATE)).willReturn(i); given(row.getBigDecimal(VALUE)).willReturn(value); RowToStockMapper mapper = new RowToStockMapper(); Stock result = mapper.apply(row); assertThat(result.getSymbol()).isEqualTo("ABC"); assertThat(result.getDate()).isEqualTo(i); assertThat(result.getValue()).isEqualTo(value); }
@Override public Stock apply(Row row) { var symbol = Objects.requireNonNull(row.getString(SYMBOL), "column symbol cannot be null"); var date = Objects.requireNonNull(row.getInstant(DATE), "column date cannot be null"); var value = Objects.requireNonNull(row.getBigDecimal(VALUE), "column value cannot be null"); return new Stock(symbol, date, value); }
RowToStockMapper implements Function<Row, Stock> { @Override public Stock apply(Row row) { var symbol = Objects.requireNonNull(row.getString(SYMBOL), "column symbol cannot be null"); var date = Objects.requireNonNull(row.getInstant(DATE), "column date cannot be null"); var value = Objects.requireNonNull(row.getBigDecimal(VALUE), "column value cannot be null"); return new Stock(symbol, date, value); } }
RowToStockMapper implements Function<Row, Stock> { @Override public Stock apply(Row row) { var symbol = Objects.requireNonNull(row.getString(SYMBOL), "column symbol cannot be null"); var date = Objects.requireNonNull(row.getInstant(DATE), "column date cannot be null"); var value = Objects.requireNonNull(row.getBigDecimal(VALUE), "column value cannot be null"); return new Stock(symbol, date, value); }  }
RowToStockMapper implements Function<Row, Stock> { @Override public Stock apply(Row row) { var symbol = Objects.requireNonNull(row.getString(SYMBOL), "column symbol cannot be null"); var date = Objects.requireNonNull(row.getInstant(DATE), "column date cannot be null"); var value = Objects.requireNonNull(row.getBigDecimal(VALUE), "column value cannot be null"); return new Stock(symbol, date, value); }  @Override Stock apply(Row row); }
RowToStockMapper implements Function<Row, Stock> { @Override public Stock apply(Row row) { var symbol = Objects.requireNonNull(row.getString(SYMBOL), "column symbol cannot be null"); var date = Objects.requireNonNull(row.getInstant(DATE), "column date cannot be null"); var value = Objects.requireNonNull(row.getBigDecimal(VALUE), "column value cannot be null"); return new Stock(symbol, date, value); }  @Override Stock apply(Row row);  }