use of org.hl7.fhir.r5.utils.validation in project openmrs-module-fhir2 by openmrs.
the class LocationAddressTranslatorImplTest method shouldTranslateLocationCountryToAddressCountry.
@Test
public void shouldTranslateLocationCountryToAddressCountry() {
omrsLocation.setCountry(COUNTRY);
org.hl7.fhir.r4.model.Address address = translator.toFhirResource(omrsLocation);
assertThat(address, notNullValue());
assertThat(address.getCountry(), notNullValue());
assertThat(address.getCountry(), equalTo(COUNTRY));
}
use of org.hl7.fhir.r5.utils.validation in project openmrs-module-fhir2 by openmrs.
the class LocationAddressTranslatorImplTest method shouldTranslateAddressStateToLocationState.
@Test
public void shouldTranslateAddressStateToLocationState() {
org.hl7.fhir.r4.model.Address address = new Address();
address.setState(STATE_PROVINCE);
omrsLocation = translator.toOpenmrsType(new Location(), address);
assertThat(omrsLocation, notNullValue());
assertThat(omrsLocation.getStateProvince(), notNullValue());
assertThat(omrsLocation.getStateProvince(), equalTo(STATE_PROVINCE));
}
use of org.hl7.fhir.r5.utils.validation in project openmrs-module-fhir2 by openmrs.
the class LocationTranslatorImplTest method shouldTranslateLocationAttributeToFhirContactPoint.
@Test
public void shouldTranslateLocationAttributeToFhirContactPoint() {
ContactPoint contactPoint = new ContactPoint();
contactPoint.setId(CONTACT_POINT_ID);
contactPoint.setValue(CONTACT_POINT_VALUE);
LocationAttribute locationAttribute = new LocationAttribute();
locationAttribute.setUuid(LOCATION_ATTRIBUTE_UUID);
locationAttribute.setValue(LOCATION_ATTRIBUTE_VALUE);
LocationAttributeType attributeType = new LocationAttributeType();
attributeType.setName(LOCATION_ATTRIBUTE_TYPE_NAME);
attributeType.setUuid(LOCATION_ATTRIBUTE_TYPE_UUID);
locationAttribute.setAttributeType(attributeType);
org.hl7.fhir.r4.model.Location location = locationTranslator.toFhirResource(new Location());
assertThat(location, notNullValue());
assertThat(location.getTelecom(), notNullValue());
}
use of org.hl7.fhir.r5.utils.validation in project openmrs-module-fhir2 by openmrs.
the class LocationTranslatorImplTest method toOpenmrsType_shouldTranslateFhirTagsToOpenmrsLocationTags.
@Test
public void toOpenmrsType_shouldTranslateFhirTagsToOpenmrsLocationTags() {
LocationTag omrsTag = new LocationTag(LAB_TAG_NAME, LAB_TAG_DESCRIPTION);
List<Coding> tags = new ArrayList<>();
Coding tag = new Coding();
tag.setCode(LAB_TAG_NAME);
tag.setDisplay(LAB_TAG_DESCRIPTION);
tags.add(tag);
org.hl7.fhir.r4.model.Location fhirLocation = new org.hl7.fhir.r4.model.Location();
fhirLocation.getMeta().setTag(tags);
when(locationTagTranslator.toOpenmrsType(tag)).thenReturn(omrsTag);
omrsLocation = locationTranslator.toOpenmrsType(fhirLocation);
assertThat(omrsLocation.getTags(), notNullValue());
assertThat(omrsLocation.getTags(), hasSize(greaterThanOrEqualTo(1)));
assertThat(omrsLocation.getTags().iterator().next().getName(), is(LAB_TAG_NAME));
}
use of org.hl7.fhir.r5.utils.validation in project elexis-server by elexis.
the class PractitionerRoleTest method getPractitionerRole.
@Test
public void getPractitionerRole() {
// search by role
Bundle results = client.search().forResource(PractitionerRole.class).where(PractitionerRole.ROLE.exactly().systemAndCode(org.hl7.fhir.r4.model.codesystems.PractitionerRole.DOCTOR.getSystem(), org.hl7.fhir.r4.model.codesystems.PractitionerRole.DOCTOR.toCode())).returnBundle(Bundle.class).execute();
assertNotNull(results);
List<BundleEntryComponent> entries = results.getEntry();
assertFalse(entries.isEmpty());
PractitionerRole practitionerRole = (PractitionerRole) entries.get(0).getResource();
List<CodeableConcept> roles = practitionerRole.getCode();
boolean doctorRoleFound = false;
for (CodeableConcept role : roles) {
List<Coding> codings = role.getCoding();
for (Coding coding : codings) {
if (coding.getSystem().equals(org.hl7.fhir.r4.model.codesystems.PractitionerRole.DOCTOR.getSystem()) && coding.getCode().equals(org.hl7.fhir.r4.model.codesystems.PractitionerRole.DOCTOR.toCode())) {
doctorRoleFound = true;
}
}
}
assertTrue(doctorRoleFound);
}
Aggregations