new Trade("UK21341EAH46", 112, new BigDecimal("18.12"), "customer2"),
new Trade("UK21341EAH47", 245, new BigDecimal("12.78"), "customer2"),
new Trade("UK21341EAH48", 108, new BigDecimal("109.25"), "customer3"),
new Trade("UK21341EAH49", 854, new BigDecimal("123.39"), "customer4"));
jdbcTemplate.query(GET_TRADES, new RowCallbackHandler() {
@Override
public void processRow(ResultSet rs) throws SQLException {
Trade trade = trades.get(activeRow++);
assertTrue(trade.getIsin().equals(rs.getString(1)));
assertTrue(trade.getQuantity() == rs.getLong(2));
assertTrue(trade.getPrice().equals(rs.getBigDecimal(3)));
assertTrue(trade.getCustomer().equals(rs.getString(4)));
}
});
assertEquals(activeRow, trades.size());
activeRow = 0;
jdbcTemplate.query(GET_CUSTOMERS, new RowCallbackHandler() {
@Override
public void processRow(ResultSet rs) throws SQLException {
Customer customer = customers.get(activeRow++);
assertEquals(customer.getName(),rs.getString(1));