use of org.openmrs.CodedOrFreeText in project openmrs-core by openmrs.
the class HibernateDiagnosisDAOTest method shouldSaveDiagnosis.
@Test
public void shouldSaveDiagnosis() {
CodedOrFreeText codedOrFreeText = new CodedOrFreeText(new Concept(4), new ConceptName(5089), "non coded");
int diagnosisId = 5;
Diagnosis diagnosis = new Diagnosis();
diagnosis.setEncounter(new Encounter(3));
diagnosis.setRank(2);
diagnosis.setId(diagnosisId);
diagnosis.setCertainty(ConditionVerificationStatus.CONFIRMED);
diagnosis.setPatient(new Patient(2));
diagnosis.setCondition(new Condition());
diagnosis.setDiagnosis(codedOrFreeText);
diagnosis.setUuid("4e663d96-6b78-11e0-93c3-18a9b5e044dc");
diagnosis.setCreator(new User(1));
diagnosis.setVoided(false);
diagnosis.setDateCreated(new Date());
diagnosisDAO.saveDiagnosis(diagnosis);
Diagnosis savedDiagnosis = diagnosisDAO.getDiagnosisById(diagnosisId);
assertEquals(diagnosis.getUuid(), savedDiagnosis.getUuid());
assertEquals(diagnosis.getVoided(), savedDiagnosis.getVoided());
assertEquals(diagnosis.getRank(), savedDiagnosis.getRank());
assertEquals(diagnosis.getCertainty(), savedDiagnosis.getCertainty());
assertEquals(diagnosis.getCreator(), savedDiagnosis.getCreator());
assertEquals(diagnosis.getCondition(), savedDiagnosis.getCondition());
assertEquals(diagnosis.getPatient(), savedDiagnosis.getPatient());
assertEquals(diagnosis.getEncounter(), savedDiagnosis.getEncounter());
}
Aggregations