JdbcProductDao extends JdbcDaoSupport implements ProductDao { @Override public List<Product> findBySize(final String size) { return getJdbcTemplate().query( "select ID,NAME,SIZE,PRICE from PRODUCT where SIZE = ?", PRODUCT_ROW_MAPPER, size ); } 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 findBySize_should_returnThoseProductsHavingThatSize() { daleq.insertIntoDatabase( aTable(ProductTable.class) .withRowsBetween(0, 9) .with( aRow(10).f(SIZE, "S"), aRow(11).f(SIZE, "S"), aRow(12).f(SIZE, "M"), aRow(13).f(SIZE, "L") ) ); final List<Product> products = productDao.findBySize("S"); assertProductsWithIds(products, 10L, 11L); }