### Question:
HibernateDiagnosisDAO implements DiagnosisDAO { @Override public List<Diagnosis> getDiagnoses(Encounter encounter){ Query query = sessionFactory.getCurrentSession().createQuery( "from Diagnosis d where d.encounter.encounterId = :encounterId order by dateCreated desc"); query.setInteger("encounterId", encounter.getId()); return query.list(); }  void setSessionFactory(SessionFactory sessionFactory); @Override Diagnosis saveDiagnosis(Diagnosis diagnosis); @SuppressWarnings("unchecked") @Override List<Diagnosis> getActiveDiagnoses(Patient patient, Date fromDate); @Override List<Diagnosis> getDiagnoses(Encounter encounter); @Override List<Diagnosis> getPrimaryDiagnoses(Encounter encounter); @Override Diagnosis getDiagnosisById(Integer diagnosisId); @Override Diagnosis getDiagnosisByUuid(String uuid); @Override void deleteDiagnosis(Diagnosis diagnosis);  }### Answer:
@Test public void shouldGetDiagnoses() { assertEquals(2, diagnosisDAO.getDiagnoses(new Encounter(3)).size()); assertEquals(0, diagnosisDAO.getDiagnoses(new Encounter(9)).size()); }