use of org.hl7.fhir.r4.model.AllergyIntolerance in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceTranslatorImplTest method toFhirResource_shouldTranslateUuidToId.
@Test
public void toFhirResource_shouldTranslateUuidToId() {
omrsAllergy.setUuid(ALLERGY_UUID);
AllergyIntolerance allergyIntolerance = allergyIntoleranceTranslator.toFhirResource(omrsAllergy);
assertThat(allergyIntolerance, notNullValue());
assertThat(allergyIntolerance.getId(), equalTo(ALLERGY_UUID));
}
use of org.hl7.fhir.r4.model.AllergyIntolerance in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceTranslatorImplTest method toFhirResource_shouldReturnNullSeverityIfSeverityConceptIsNull.
@Test
public void toFhirResource_shouldReturnNullSeverityIfSeverityConceptIsNull() {
omrsAllergy.setSeverity(null);
AllergyIntolerance allergyIntolerance = allergyIntoleranceTranslator.toFhirResource(omrsAllergy);
assertThat(allergyIntolerance.getReaction().get(0).getSeverity(), nullValue());
}
use of org.hl7.fhir.r4.model.AllergyIntolerance in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceTranslatorImplTest method toFhirResource_shouldTranslateOpenMrsDateChangedToLastUpdatedDate.
@Test
public void toFhirResource_shouldTranslateOpenMrsDateChangedToLastUpdatedDate() {
omrsAllergy.setDateChanged(new Date());
AllergyIntolerance allergyIntolerance = allergyIntoleranceTranslator.toFhirResource(omrsAllergy);
assertThat(allergyIntolerance, notNullValue());
assertThat(allergyIntolerance.getMeta().getLastUpdated(), DateMatchers.sameDay(new Date()));
}
use of org.hl7.fhir.r4.model.AllergyIntolerance in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceTranslatorImplTest method toFhirResource_shouldTranslateToNullCriticality.
@Test
public void toFhirResource_shouldTranslateToNullCriticality() {
Concept otherConcept = new Concept();
otherConcept.setUuid(GLOBAL_PROPERTY_OTHER_VALUE);
omrsAllergy.setSeverity(otherConcept);
when(severityTranslator.toFhirResource(otherConcept)).thenReturn(AllergyIntolerance.AllergyIntoleranceSeverity.NULL);
when(criticalityTranslator.toFhirResource(AllergyIntolerance.AllergyIntoleranceSeverity.NULL)).thenReturn(AllergyIntolerance.AllergyIntoleranceCriticality.NULL);
AllergyIntolerance allergyIntolerance = allergyIntoleranceTranslator.toFhirResource(omrsAllergy);
assertThat(allergyIntolerance, notNullValue());
assertThat(allergyIntolerance.getCriticality(), equalTo(AllergyIntolerance.AllergyIntoleranceCriticality.NULL));
}
use of org.hl7.fhir.r4.model.AllergyIntolerance in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceTranslatorImplTest method toFhirResource_shouldTranslateVoidedTrueToInactive.
@Test
public void toFhirResource_shouldTranslateVoidedTrueToInactive() {
omrsAllergy.setVoided(true);
AllergyIntolerance allergyIntolerance = allergyIntoleranceTranslator.toFhirResource(omrsAllergy);
assertThat(allergyIntolerance.getClinicalStatus().getCoding().get(0).getCode(), equalTo("inactive"));
assertThat(allergyIntolerance.getClinicalStatus().getCoding().get(0).getDisplay(), equalTo("Inactive"));
assertThat(allergyIntolerance.getClinicalStatus().getText(), equalTo("Inactive"));
}
Aggregations