### Question:
HibernatePatientDAO implements PatientDAO { @SuppressWarnings("unchecked") @Override public List<PatientIdentifier> getPatientIdentifiers(String identifier, List<PatientIdentifierType> patientIdentifierTypes, List<Location> locations, List<Patient> patients, Boolean isPreferred) throws DAOException { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(PatientIdentifier.class); criteria.createAlias("patient", "patient"); criteria.add(Restrictions.eq("patient.voided", false)); criteria.add(Restrictions.eq("voided", false)); if (identifier != null) { criteria.add(Restrictions.eq("identifier", identifier)); } if (!patientIdentifierTypes.isEmpty()) { criteria.add(Restrictions.in("identifierType", patientIdentifierTypes)); } if (!locations.isEmpty()) { criteria.add(Restrictions.in("location", locations)); } if (!patients.isEmpty()) { criteria.add(Restrictions.in("patient", patients)); } if (isPreferred != null) { criteria.add(Restrictions.eq("preferred", isPreferred)); } return criteria.list(); }  void setSessionFactory(SessionFactory sessionFactory); @Override Patient getPatient(Integer patientId); @Override Patient savePatient(Patient patient); @Override List<Patient> getPatients(String query, boolean includeVoided, Integer start, Integer length); @Override List<Patient> getPatients(String query, Integer start, Integer length); @SuppressWarnings("unchecked") @Override List<Patient> getAllPatients(boolean includeVoided); @Override void deletePatientIdentifierType(PatientIdentifierType patientIdentifierType); @SuppressWarnings("unchecked") @Override List<PatientIdentifier> getPatientIdentifiers(String identifier,
	        List<PatientIdentifierType> patientIdentifierTypes, List<Location> locations, List<Patient> patients,
	        Boolean isPreferred); @Override PatientIdentifierType savePatientIdentifierType(PatientIdentifierType patientIdentifierType); @Override void deletePatient(Patient patient); @Override PatientIdentifierType getPatientIdentifierType(Integer patientIdentifierTypeId); @SuppressWarnings("unchecked") @Override List<PatientIdentifierType> getAllPatientIdentifierTypes(boolean includeRetired); @SuppressWarnings("unchecked") @Override List<PatientIdentifierType> getPatientIdentifierTypes(String name, String format, Boolean required,
	        Boolean hasCheckDigit); @SuppressWarnings("unchecked") @Override List<Patient> getDuplicatePatientsByAttributes(List<String> attributes); @Override Patient getPatientByUuid(String uuid); @Override PatientIdentifier getPatientIdentifierByUuid(String uuid); @Override PatientIdentifierType getPatientIdentifierTypeByUuid(String uuid); @Override boolean isIdentifierInUseByAnotherPatient(PatientIdentifier patientIdentifier); @Override PatientIdentifier getPatientIdentifier(Integer patientIdentifierId); @Override PatientIdentifier savePatientIdentifier(PatientIdentifier patientIdentifier); @Override void deletePatientIdentifier(PatientIdentifier patientIdentifier); @Override Long getCountOfPatients(String query); @Override Long getCountOfPatients(String query, boolean includeVoided); List<Patient> findPatients(String query, boolean includeVoided, Integer start, Integer length); @Override List<Allergy> getAllergies(Patient patient); @Override String getAllergyStatus(Patient patient); @Override Allergies saveAllergies(Patient patient, Allergies allergies); @Override Allergy getAllergy(Integer allergyId); @Override Allergy getAllergyByUuid(String uuid); @Override Allergy saveAllergy(Allergy allergy);  }### Answer:
@Test public void getPatientIdentifiers_shouldGetByIdentifierType() { List<PatientIdentifierType> identifierTypes = singletonList(new PatientIdentifierType(2)); List<PatientIdentifier> identifiers = hibernatePatientDao .getPatientIdentifiers(null, identifierTypes, emptyList(), emptyList(), null); List<Integer> identifierIds = identifiers.stream().map(PatientIdentifier::getId) .collect(Collectors.toList()); Assert.assertEquals(2, identifiers.size()); Assert.assertThat(identifierIds, hasItems(1, 3)); }