@Test(expected = IllegalArgumentException.class) public void findTestOnBadUserId() { testedHumansDao.find(44); }
@Override public Human find(int id) { try { return template.queryForObject(SQL_SELECT_USER_BY_ID, humanRowMapper, id); } catch (EmptyResultDataAccessException e) { throw new IllegalArgumentException("User with id <" + id + "> not found"); } }
HumansJdbcTemplateDaoImpl implements HumansDao { @Override public Human find(int id) { try { return template.queryForObject(SQL_SELECT_USER_BY_ID, humanRowMapper, id); } catch (EmptyResultDataAccessException e) { throw new IllegalArgumentException("User with id <" + id + "> not found"); } } }
HumansJdbcTemplateDaoImpl implements HumansDao { @Override public Human find(int id) { try { return template.queryForObject(SQL_SELECT_USER_BY_ID, humanRowMapper, id); } catch (EmptyResultDataAccessException e) { throw new IllegalArgumentException("User with id <" + id + "> not found"); } } HumansJdbcTemplateDaoImpl(DataSource dataSource); }
HumansJdbcTemplateDaoImpl implements HumansDao { @Override public Human find(int id) { try { return template.queryForObject(SQL_SELECT_USER_BY_ID, humanRowMapper, id); } catch (EmptyResultDataAccessException e) { throw new IllegalArgumentException("User with id <" + id + "> not found"); } } HumansJdbcTemplateDaoImpl(DataSource dataSource); @Override List<Human> findAllByAge(int age); @Override void save(Human model); @Override Human find(int id); @Override void update(Human model); @Override void delete(int id); @Override List<Human> findAll(); }
HumansJdbcTemplateDaoImpl implements HumansDao { @Override public Human find(int id) { try { return template.queryForObject(SQL_SELECT_USER_BY_ID, humanRowMapper, id); } catch (EmptyResultDataAccessException e) { throw new IllegalArgumentException("User with id <" + id + "> not found"); } } HumansJdbcTemplateDaoImpl(DataSource dataSource); @Override List<Human> findAllByAge(int age); @Override void save(Human model); @Override Human find(int id); @Override void update(Human model); @Override void delete(int id); @Override List<Human> findAll();  }