### Question:
SQLUserDAO implements UserDAO { @Override public List<IUser> getByName(String name) { try { List<IUser> result = new LinkedList<IUser>(); PreparedStatement ps = connection.prepareStatement(GET_BY_NAME_SQL); ps.setString(1, name); ResultSet r = ps.executeQuery(); while (r.next()) { result.add(readUser(r)); } r.close(); ps.close(); return result; } catch (SQLException e) { throw new RuntimeException(e); } } SQLUserDAO(Connection c); @Override void delete(IUser user); @Override List<IUser> getAll(); @Override IUser getById(int id); @Override List<IUser> getByName(String name); @Override void saveOrUpdate(IUser user);  }### Answer:
@Test(expected = RuntimeException.class) public void testGetByName() throws SQLException { UserDAO dao = new SQLUserDAO(connection); List<IUser> userlist = dao.getByName("Duck"); assertEquals(2, userlist.size()); connection.close(); dao.getByName("Duck"); }