HibernatePatientListDAO implements PatientListDAO { @Override public List<PatientList> getPatientListByName(String name) throws DAOException { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(PatientList.class); criteria.add(Restrictions.like("name", name)); criteria.add(Restrictions.like("retired", false)); List<PatientList> patients = new ArrayList<PatientList>(); patients.addAll(criteria.list()); return patients; }  void setSessionFactory(SessionFactory sessionFactory); @Override PatientList savePatientList(PatientList patientList); @Override void deletePatientList(PatientList patientList); @Override PatientList getPatientList(Integer patientListId); @Override List<PatientList> getPatientListByEncounterType(EncounterType encounterType); @Override PatientList getPatientListByUuid(String uuid); @Override List<PatientList> getPatientListByName(String name); @Override List<PatientList> getAllPatientList(boolean includeRetired); @Override PatientList updatePatientList(PatientList patientList);  }
@Test public void testGetPatientListByName() { String name = "TestList1"; String result = dao.getPatientListByName(name).get(0).getName(); assertEquals(name, result); }