@Test void test_find_all() { List<Employee> employees = employeeRepository.findAll(); assertThat(employees).isNotNull(); assertThat(employees.size()).isEqualTo(3); assertThat(employees.get(0)).isEqualTo(johnDoe); assertThat(employees.get(1)).isEqualTo(maryJackson); assertThat(employees.get(2)).isEqualTo(peterGrey); }
public List<Employee> findAll() { String sqlQuery = "select id, first_name, last_name, yearly_income from employees"; return jdbcTemplate.query(sqlQuery, this::mapRowToEmployee); }
EmployeeRepository { public List<Employee> findAll() { String sqlQuery = "select id, first_name, last_name, yearly_income from employees"; return jdbcTemplate.query(sqlQuery, this::mapRowToEmployee); } }
EmployeeRepository { public List<Employee> findAll() { String sqlQuery = "select id, first_name, last_name, yearly_income from employees"; return jdbcTemplate.query(sqlQuery, this::mapRowToEmployee); } @Autowired  EmployeeRepository(JdbcTemplate jdbcTemplate); }
EmployeeRepository { public List<Employee> findAll() { String sqlQuery = "select id, first_name, last_name, yearly_income from employees"; return jdbcTemplate.query(sqlQuery, this::mapRowToEmployee); } @Autowired  EmployeeRepository(JdbcTemplate jdbcTemplate); boolean exists(long id); Employee findOne(long id); List<Employee> findAll(); void save(Employee employee); long saveAndReturnId(Employee employee); long simpleSave(Employee employee); void update(Employee employee); boolean delete(long id); }
EmployeeRepository { public List<Employee> findAll() { String sqlQuery = "select id, first_name, last_name, yearly_income from employees"; return jdbcTemplate.query(sqlQuery, this::mapRowToEmployee); } @Autowired  EmployeeRepository(JdbcTemplate jdbcTemplate); boolean exists(long id); Employee findOne(long id); List<Employee> findAll(); void save(Employee employee); long saveAndReturnId(Employee employee); long simpleSave(Employee employee); void update(Employee employee); boolean delete(long id);  }