@Test void test_find_one() { Employee employee = employeeRepository.findOne(1); assertThat(employee).isNotNull(); assertThat(employee).isEqualTo(johnDoe); }
public Employee findOne(long id) { String sqlQuery = "select id, first_name, last_name, yearly_income " + "from employees where id = ?"; return jdbcTemplate.queryForObject(sqlQuery, this::mapRowToEmployee, id); }
EmployeeRepository { public Employee findOne(long id) { String sqlQuery = "select id, first_name, last_name, yearly_income " + "from employees where id = ?"; return jdbcTemplate.queryForObject(sqlQuery, this::mapRowToEmployee, id); } }
EmployeeRepository { public Employee findOne(long id) { String sqlQuery = "select id, first_name, last_name, yearly_income " + "from employees where id = ?"; return jdbcTemplate.queryForObject(sqlQuery, this::mapRowToEmployee, id); } @Autowired  EmployeeRepository(JdbcTemplate jdbcTemplate); }
EmployeeRepository { public Employee findOne(long id) { String sqlQuery = "select id, first_name, last_name, yearly_income " + "from employees where id = ?"; return jdbcTemplate.queryForObject(sqlQuery, this::mapRowToEmployee, id); } @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 Employee findOne(long id) { String sqlQuery = "select id, first_name, last_name, yearly_income " + "from employees where id = ?"; return jdbcTemplate.queryForObject(sqlQuery, this::mapRowToEmployee, id); } @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);  }