JdbcProductDao extends JdbcDaoSupport implements ProductDao { @Override public void saveAll(final Iterable<Product> products) { for (Product product : products) { save(product); } } JdbcProductDao(final DataSource dataSource); @Override Product findById(final long id); @Override List<Product> findBySize(final String size); @Override void save(final Product product); @Override void saveAll(final Iterable<Product> products);  }
@Test public void saveAll_should_inserAllThoseProducts() { final List<Product> products = Lists.newArrayList( aProduct("p1", aPrice(100), "S1"), aProduct("p2", aPrice(200), "S2"), aProduct("p3", aPrice(300), "S3"), aProduct("p4", aPrice(400), "S4") ); productDao.saveAll(products); final Table expected = aTable(ProductTable.class).with( aRow(0).f(NAME, "p1").f(PRICE, "1.00").f(SIZE, "S1"), aRow(1).f(NAME, "p2").f(PRICE, "2.00").f(SIZE, "S2"), aRow(2).f(NAME, "p3").f(PRICE, "3.00").f(SIZE, "S3"), aRow(3).f(NAME, "p4").f(PRICE, "4.00").f(SIZE, "S4") ); daleq.assertTableInDatabase(expected, ID); }