customers = Arrays.asList(new Customer("customer1", (credits.get("customer1") - 98.34)),
new Customer("customer2", (credits.get("customer2") - 18.12 - 12.78)),
new Customer("customer3", (credits.get("customer3") - 109.25)),
new Customer("customer4", credits.get("customer4") - 123.39));
trades = Arrays.asList(new Trade("UK21341EAH45", 978, new BigDecimal("98.34"), "customer1"),
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());