use of org.openmrs.ConditionVerificationStatus in project openmrs-core by openmrs.
the class HibernateConditionDAOTest method shouldSaveCondition.
@Test
public void shouldSaveCondition() {
CodedOrFreeText codedOrFreeText = new CodedOrFreeText(new Concept(4), new ConceptName(5089), "non coded");
ConditionClinicalStatus clinicalStatus = ConditionClinicalStatus.ACTIVE;
ConditionVerificationStatus verificationStatus = ConditionVerificationStatus.CONFIRMED;
Patient patient = new Patient(2);
Date onsetDate = new Date();
Date endDate = new Date();
Condition previousVersion = dao.getConditionByUuid("2cc6880e-2c46-15e4-9038-a6c5e4d22fb7");
String additionalDetail = "additionalDetail";
int conditionId = 20;
Condition condition = new Condition();
condition.setConditionId(conditionId);
condition.setCondition(codedOrFreeText);
condition.setClinicalStatus(clinicalStatus);
condition.setVerificationStatus(verificationStatus);
condition.setPreviousVersion(previousVersion);
condition.setAdditionalDetail(additionalDetail);
condition.setOnsetDate(onsetDate);
condition.setEndDate(endDate);
condition.setPatient(patient);
dao.saveCondition(condition);
Condition savedCondition = dao.getCondition(conditionId);
assertEquals(additionalDetail, savedCondition.getAdditionalDetail());
assertEquals(conditionId, (int) savedCondition.getConditionId());
assertEquals(onsetDate, savedCondition.getOnsetDate());
assertEquals(endDate, savedCondition.getEndDate());
assertEquals(clinicalStatus, savedCondition.getClinicalStatus());
assertEquals(verificationStatus, savedCondition.getVerificationStatus());
assertEquals(previousVersion, savedCondition.getPreviousVersion());
assertEquals(patient, savedCondition.getPatient());
}
use of org.openmrs.ConditionVerificationStatus in project openmrs-core by openmrs.
the class HibernateConditionDAOTest method shouldGetCondition.
@Test
public void shouldGetCondition() {
int id = 1;
ConditionClinicalStatus expectedClinicalStatus = ConditionClinicalStatus.INACTIVE;
ConditionVerificationStatus expectedVerificationStatus = ConditionVerificationStatus.PROVISIONAL;
Condition condition = dao.getCondition(id);
assertEquals(expectedClinicalStatus, condition.getClinicalStatus());
assertEquals(expectedVerificationStatus, condition.getVerificationStatus());
assertEquals(1, (int) condition.getId());
assertEquals(null, condition.getEndDate());
assertEquals(1, (int) condition.getCreator().getId());
}
use of org.openmrs.ConditionVerificationStatus in project openmrs-core by openmrs.
the class HibernateConditionDAOTest method shouldGetConditionByUuid.
@Test
public void shouldGetConditionByUuid() {
String uuid = "2cc6880e-2c46-15e4-9038-a6c5e4d22fb7";
ConditionClinicalStatus expectedClinicalStatus = ConditionClinicalStatus.INACTIVE;
ConditionVerificationStatus expectedVerificationStatus = ConditionVerificationStatus.PROVISIONAL;
Condition condition = dao.getConditionByUuid(uuid);
assertEquals(condition.getClinicalStatus(), expectedClinicalStatus);
assertEquals(condition.getVerificationStatus(), expectedVerificationStatus);
assertEquals(1, (int) condition.getId());
assertEquals(null, condition.getEndDate());
assertEquals(1, (int) condition.getCreator().getId());
}
Aggregations