### Question:
DiagnosisServiceImpl extends BaseOpenmrsService implements DiagnosisService { @Override @Transactional(readOnly = true) public List<Diagnosis> getDiagnoses(Patient patient, Date fromDate) { return diagnosisDAO.getActiveDiagnoses(patient, fromDate); }  @Override Diagnosis save(Diagnosis diagnosis); @Override Diagnosis voidDiagnosis(Diagnosis diagnosis, String voidReason); @Override Diagnosis getDiagnosisByUuid(String uuid); @Override @Transactional(readOnly = true) List<Diagnosis> getDiagnoses(Patient patient, Date fromDate); @Override @Transactional(readOnly = true) List<Diagnosis> getPrimaryDiagnoses(Encounter encounter); @Override @Transactional(readOnly = true) List<Diagnosis> getUniqueDiagnoses(Patient patient, Date fromDate); @Override @Transactional(readOnly = true) Diagnosis getDiagnosis(Integer diagnosisId); @Override Diagnosis unvoidDiagnosis(Diagnosis diagnosis); @Override void purgeDiagnosis(Diagnosis diagnosis); DiagnosisDAO getDiagnosisDAO(); void setDiagnosisDAO(DiagnosisDAO diagnosisDAO);  }### Answer:
@Test public void getDiagnoses_shouldGetDiagnosesOfPatientWithDate(){ Calendar calendar = new GregorianCalendar(2015, 12, 1, 0, 0, 0); Patient patient = patientService.getPatient(2); List<Diagnosis> diagnoses = diagnosisService.getDiagnoses(patient, calendar.getTime()); Assert.assertEquals(2, diagnoses.size()); Assert.assertEquals("68802cce-6880-17e4-6880-a68804d22fb7", diagnoses.get(0).getUuid()); Assert.assertEquals("688804ce-6880-8804-6880-a68804d88047", diagnoses.get(1).getUuid()); }
@Test public void getDiagnoses_shouldGetDiagnosesOfPatientWithDifferentDate(){ Calendar calendar = new GregorianCalendar(2016, 12, 1, 0, 0, 0); Patient patient = patientService.getPatient(2); List<Diagnosis> diagnoses = diagnosisService.getDiagnoses(patient, calendar.getTime()); Assert.assertEquals(1, diagnoses.size()); Assert.assertEquals("68802cce-6880-17e4-6880-a68804d22fb7", diagnoses.get(0).getUuid()); }
@Test public void getDiagnoses_shouldGetDiagnosesOfPatientWithoutDate(){ Patient patient = patientService.getPatient(2); List<Diagnosis> diagnoses = diagnosisService.getDiagnoses(patient, null); Assert.assertEquals(3, diagnoses.size()); Assert.assertEquals("68802cce-6880-17e4-6880-a68804d22fb7", diagnoses.get(0).getUuid()); Assert.assertEquals("688804ce-6880-8804-6880-a68804d88047", diagnoses.get(1).getUuid()); Assert.assertEquals("88042cce-8804-17e4-8804-a68804d22fb7", diagnoses.get(2).getUuid()); }