Search in sources :

Example 16 with Condition

use of org.openmrs.Condition in project openmrs-core by openmrs.

the class ConditionServiceImplTest method purgeCondition_shouldPurgeCondition.

/**
 * @see ConditionService#purgeCondition(Condition)
 */
@Test
public void purgeCondition_shouldPurgeCondition() {
    Integer conditionId = 1;
    Condition existingCondition = conditionService.getCondition(conditionId);
    Assert.assertNotNull(existingCondition);
    conditionService.purgeCondition(conditionService.getCondition(conditionId));
    Condition purgedCondition = conditionService.getCondition(conditionId);
    Assert.assertNull(purgedCondition);
}
Also used : Condition(org.openmrs.Condition) Test(org.junit.Test) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest)

Example 17 with Condition

use of org.openmrs.Condition in project openmrs-core by openmrs.

the class ConditionValidatorTest method setUp.

@Before
public void setUp() {
    validator = new ConditionValidator();
    condition = new Condition();
    errors = new BindException(condition, "condition");
}
Also used : Condition(org.openmrs.Condition) BindException(org.springframework.validation.BindException) Before(org.junit.Before)

Example 18 with Condition

use of org.openmrs.Condition in project openmrs-core by openmrs.

the class ConditionValidatorTest method shouldFailIfGivenConditionWithNullConditionProperties.

@Test
public void shouldFailIfGivenConditionWithNullConditionProperties() {
    Condition condition = new Condition();
    validator.validate(condition, errors);
    Assert.assertTrue(errors.hasFieldErrors("condition"));
    Assert.assertTrue(errors.hasFieldErrors("clinicalStatus"));
}
Also used : Condition(org.openmrs.Condition) Test(org.junit.Test)

Example 19 with Condition

use of org.openmrs.Condition 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());
}
Also used : Concept(org.openmrs.Concept) Condition(org.openmrs.Condition) User(org.openmrs.User) ConceptName(org.openmrs.ConceptName) Encounter(org.openmrs.Encounter) Patient(org.openmrs.Patient) Diagnosis(org.openmrs.Diagnosis) CodedOrFreeText(org.openmrs.CodedOrFreeText) Date(java.util.Date) Test(org.junit.Test) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest)

Aggregations

Condition (org.openmrs.Condition)19 Test (org.junit.Test)16 BaseContextSensitiveTest (org.openmrs.test.BaseContextSensitiveTest)14 Patient (org.openmrs.Patient)7 Concept (org.openmrs.Concept)5 CodedOrFreeText (org.openmrs.CodedOrFreeText)4 ConceptName (org.openmrs.ConceptName)3 ConditionClinicalStatus (org.openmrs.ConditionClinicalStatus)3 ConditionVerificationStatus (org.openmrs.ConditionVerificationStatus)3 Date (java.util.Date)2 Diagnosis (org.openmrs.Diagnosis)2 Encounter (org.openmrs.Encounter)2 ArrayList (java.util.ArrayList)1 Locale (java.util.Locale)1 Before (org.junit.Before)1 User (org.openmrs.User)1 BindException (org.springframework.validation.BindException)1