@Test public void testFindAll() throws Exception { List<Person> expected = createListOfPeopleWithLastname("Smith"); JdbcTemplate template = createMock(JdbcTemplate.class); template.query(eq("SELECT * FROM employee"), aryEq(new Object[0]), isA(PersonRowMapper.class)); expectLastCall().andReturn(expected); replay(template); JdbcTemplatePersonDao dao = new JdbcTemplatePersonDao(); dao.setJdbcTemplate(template); assertEquals(expected, dao.findAll()); verify(template); }
@SuppressWarnings("unchecked") public List<Person> findAll() { return getJdbcTemplate().query("SELECT * FROM employee", new Object[0], new PersonRowMapper()); }
JdbcTemplatePersonDao extends JdbcDaoSupport implements
        PersonDao { @SuppressWarnings("unchecked") public List<Person> findAll() { return getJdbcTemplate().query("SELECT * FROM employee", new Object[0], new PersonRowMapper()); } }
JdbcTemplatePersonDao extends JdbcDaoSupport implements
        PersonDao { @SuppressWarnings("unchecked") public List<Person> findAll() { return getJdbcTemplate().query("SELECT * FROM employee", new Object[0], new PersonRowMapper()); }  }
JdbcTemplatePersonDao extends JdbcDaoSupport implements
        PersonDao { @SuppressWarnings("unchecked") public List<Person> findAll() { return getJdbcTemplate().query("SELECT * FROM employee", new Object[0], new PersonRowMapper()); }  @SuppressWarnings("unchecked") List<Person> findAll(); @SuppressWarnings("unchecked") List<Person> findByLastName(String lastName); @SuppressWarnings("unchecked") List<Person> findByLastname(String lastname); void save(final Person person); Person find(Long id); }
JdbcTemplatePersonDao extends JdbcDaoSupport implements
        PersonDao { @SuppressWarnings("unchecked") public List<Person> findAll() { return getJdbcTemplate().query("SELECT * FROM employee", new Object[0], new PersonRowMapper()); }  @SuppressWarnings("unchecked") List<Person> findAll(); @SuppressWarnings("unchecked") List<Person> findByLastName(String lastName); @SuppressWarnings("unchecked") List<Person> findByLastname(String lastname); void save(final Person person); Person find(Long id);  }