use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ENCOUNTER in project openmrs-module-fhir2 by openmrs.
the class EncounterTranslatorImplTest method toFhirResource_shouldTranslateLocationToEncounterDefaultClass.
@Test
public void toFhirResource_shouldTranslateLocationToEncounterDefaultClass() {
omrsEncounter.setLocation(location);
Encounter result = encounterTranslator.toFhirResource(omrsEncounter);
assertThat(result, notNullValue());
assertThat(result.getClass_(), notNullValue());
assertThat(result.getClass_().getSystem(), is(FhirConstants.ENCOUNTER_CLASS_VALUE_SET_URI));
assertThat(result.getClass_().getCode(), is("AMB"));
}
use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ENCOUNTER in project openmrs-module-fhir2 by openmrs.
the class EncounterTranslatorImplTest method toFhirResource_shouldTranslateLocationToEncounterLocationWithCorrectReference.
@Test
public void toFhirResource_shouldTranslateLocationToEncounterLocationWithCorrectReference() {
omrsEncounter.setLocation(location);
Encounter.EncounterLocationComponent locationComponent = new Encounter.EncounterLocationComponent();
Reference locationRef = new Reference();
locationRef.setReference(LOCATION_URI);
locationRef.setDisplay(TEST_LOCATION_NAME);
locationComponent.setLocation(locationRef);
when(encounterLocationTranslator.toFhirResource(location)).thenReturn(locationComponent);
Encounter result = encounterTranslator.toFhirResource(omrsEncounter);
assertThat(result, notNullValue());
assertThat(result.getLocation(), notNullValue());
assertThat(result.getLocation().size(), is(1));
assertThat(result.getLocation().get(0).getLocation().getDisplay(), equalTo(TEST_LOCATION_NAME));
}
use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ENCOUNTER in project openmrs-module-fhir2 by openmrs.
the class BaseReferenceHandlingTranslatorTest method shouldAddEncounterReference.
@Test
public void shouldAddEncounterReference() {
Reference reference = referenceHandlingTranslator.createEncounterReference(encounter);
assertThat(reference, notNullValue());
assertThat(reference.getReference(), equalTo(ENCOUNTER_URI));
assertThat(reference.getType(), equalTo(FhirConstants.ENCOUNTER));
}
use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ENCOUNTER in project openmrs-module-fhir2 by openmrs.
the class DiagnosticReportTranslatorImplTest method toFhirResource_shouldConvertEncounter.
@Test
public void toFhirResource_shouldConvertEncounter() {
Encounter encounter = new Encounter();
Reference encounterReference = new Reference();
fhirDiagnosticReport.setEncounter(encounter);
when(encounterReferenceTranslator.toFhirResource(encounter)).thenReturn(encounterReference);
DiagnosticReport result = translator.toFhirResource(fhirDiagnosticReport);
assertThat(result.getEncounter(), equalTo(encounterReference));
}
use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ENCOUNTER in project openmrs-module-fhir2 by openmrs.
the class EncounterPeriodTranslatorImplTest method toOpenmrsObject_shouldMapPeriodStartToEncounterDatetime.
@Test
public void toOpenmrsObject_shouldMapPeriodStartToEncounterDatetime() {
Date encounterDate = new java.util.Date();
Encounter encounter = new Encounter();
Period period = new Period();
period.setStart(encounterDate);
Encounter result = encounterPeriodTranslator.toOpenmrsType(encounter, period);
assertThat(result, notNullValue());
assertThat(result.getEncounterDatetime(), equalTo(encounterDate));
}
Aggregations