@Test void test_exists_for_existing_employee() { boolean exists = employeeRepository.exists(1); assertThat(exists).isTrue(); }
public boolean exists(long id) { String sqlQuery = "select count(*) from employees where id = ?"; int result = jdbcTemplate.queryForObject(sqlQuery, Integer.class, id); return result == 1; }
EmployeeRepository { public boolean exists(long id) { String sqlQuery = "select count(*) from employees where id = ?"; int result = jdbcTemplate.queryForObject(sqlQuery, Integer.class, id); return result == 1; } }
EmployeeRepository { public boolean exists(long id) { String sqlQuery = "select count(*) from employees where id = ?"; int result = jdbcTemplate.queryForObject(sqlQuery, Integer.class, id); return result == 1; } @Autowired  EmployeeRepository(JdbcTemplate jdbcTemplate); }
EmployeeRepository { public boolean exists(long id) { String sqlQuery = "select count(*) from employees where id = ?"; int result = jdbcTemplate.queryForObject(sqlQuery, Integer.class, id); return result == 1; } @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 boolean exists(long id) { String sqlQuery = "select count(*) from employees where id = ?"; int result = jdbcTemplate.queryForObject(sqlQuery, Integer.class, id); return result == 1; } @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);  }