JdbcProductDao extends JdbcDaoSupport implements ProductDao { @Override public Product findById(final long id) { return getJdbcTemplate().queryForObject( "select ID,NAME,SIZE,PRICE from PRODUCT", PRODUCT_ROW_MAPPER); } 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 findById_should_returnExistingProduct() throws IOException { final long expectedId = 42L; final Table table = aTable(ProductTable.class).with( aRow(11).f(ID, expectedId) ); daleq.printTable(table, System.out); daleq.insertIntoDatabase(table); final Product product = productDao.findById(expectedId); assertThat(product.getId(), is(expectedId)); }