use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ENCOUNTER in project openmrs-module-fhir2 by openmrs.
the class EncounterPeriodTranslatorImplTest method toOpenmrsObject_shouldNotTouchEncounterDatetimeIfPeriodHasNoStartOrEnd.
@Test
public void toOpenmrsObject_shouldNotTouchEncounterDatetimeIfPeriodHasNoStartOrEnd() {
Date encounterDate = new java.util.Date();
Encounter encounter = new Encounter();
encounter.setEncounterDatetime(encounterDate);
Period period = new Period();
Encounter result = encounterPeriodTranslator.toOpenmrsType(encounter, period);
assertThat(result, notNullValue());
assertThat(result.getEncounterDatetime(), equalTo(encounterDate));
}
use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ENCOUNTER in project openmrs-module-fhir2 by openmrs.
the class EncounterReferenceTranslatorImplTest method toOpenmrsType_shouldReturnNullIfEncounterHasNoIdentifier.
@Test
public void toOpenmrsType_shouldReturnNullIfEncounterHasNoIdentifier() {
Reference encounterReference = new Reference().setReference(FhirConstants.ENCOUNTER + "/" + ENCOUNTER_UUID).setType(FhirConstants.ENCOUNTER);
Encounter result = encounterReferenceTranslator.toOpenmrsType(encounterReference);
assertThat(result, nullValue());
}
use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ENCOUNTER in project openmrs-module-fhir2 by openmrs.
the class EncounterReferenceTranslatorImplTest method toOpenmrsType_shouldConvertReferenceToEncounter.
@Test
public void toOpenmrsType_shouldConvertReferenceToEncounter() {
Reference encounterReference = new Reference().setReference(FhirConstants.ENCOUNTER + "/" + ENCOUNTER_UUID).setType(FhirConstants.ENCOUNTER).setIdentifier(new Identifier().setValue(ENCOUNTER_UUID));
Encounter encounter = new Encounter();
encounter.setUuid(ENCOUNTER_UUID);
when(dao.get(ENCOUNTER_UUID)).thenReturn(encounter);
Encounter result = encounterReferenceTranslator.toOpenmrsType(encounterReference);
assertThat(result, notNullValue());
assertThat(result.getUuid(), equalTo(ENCOUNTER_UUID));
}
use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ENCOUNTER in project openmrs-module-fhir2 by openmrs.
the class EncounterTranslatorImplTest method toFhirResource_shouldTranslateToLastUpdatedDate.
@Test
public void toFhirResource_shouldTranslateToLastUpdatedDate() {
omrsEncounter.setDateChanged(new Date());
Encounter result = encounterTranslator.toFhirResource(omrsEncounter);
assertThat(result, notNullValue());
assertThat(result.getMeta().getLastUpdated(), DateMatchers.sameDay(new Date()));
}
use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.ENCOUNTER in project openmrs-module-fhir2 by openmrs.
the class EncounterTranslatorImplTest method toFhirResource_shouldTranslateEncounterDatetimeToPeriod.
@Test
public void toFhirResource_shouldTranslateEncounterDatetimeToPeriod() {
Date encounterDate = new java.util.Date();
Period period = new Period();
omrsEncounter.setEncounterDatetime(encounterDate);
period.setStart(encounterDate);
when(encounterPeriodTranslator.toFhirResource(ArgumentMatchers.any())).thenReturn(period);
Encounter result = encounterTranslator.toFhirResource(omrsEncounter);
assertThat(result, notNullValue());
assertThat(result.getPeriod(), equalTo(period));
}
Aggregations