UserRepository { public User getById(int id) { User user; try { user = this.jdbcTemplate.queryForObject("SELECT * FROM user WHERE userID = ?", new Object[] {id}, new UserMapper()); } catch (EmptyResultDataAccessException e){ user = null; } return user; }  List<User> viewAllUsernames(); User getById(int id); String getPasswordTest(); int verifyLogin(User user); int createUser(User user); boolean updateUser(User user, int id);  }
@Test(expectedExceptions = EmptyResultDataAccessException.class) public void getByID_throwsException_withBadInput() { int id = -1; user = uRep.getById(id); }