use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.
the class PractitionerTranslatorProviderImplTest method shouldTranslateFhirNameToPersonName.
@Test
public void shouldTranslateFhirNameToPersonName() {
PersonName personName = new PersonName();
personName.setGivenName(GIVEN_NAME);
personName.setFamilyName(FAMILY_NAME);
org.hl7.fhir.r4.model.Practitioner practitioner = new org.hl7.fhir.r4.model.Practitioner();
practitioner.addIdentifier(new Identifier().setValue("349023n23b-t"));
HumanName name = practitioner.addName();
name.addGiven(GIVEN_NAME);
name.setFamily(FAMILY_NAME);
when(nameTranslator.toOpenmrsType(name)).thenReturn(personName);
Provider result = practitionerTranslator.toOpenmrsType(practitioner);
assertThat(result, notNullValue());
assertThat(result.getPerson().getGivenName(), equalTo(GIVEN_NAME));
assertThat(result.getPerson().getFamilyName(), equalTo(FAMILY_NAME));
}
use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.
the class PractitionerTranslatorProviderImplTest method shouldTranslateFhirPractitionerIdToUuid.
@Test
public void shouldTranslateFhirPractitionerIdToUuid() {
org.hl7.fhir.r4.model.Practitioner practitioner = new org.hl7.fhir.r4.model.Practitioner();
practitioner.setId(PRACTITIONER_UUID);
practitioner.addIdentifier(new Identifier().setValue("349023n23b-t"));
Provider result = practitionerTranslator.toOpenmrsType(practitioner);
assertThat(result, notNullValue());
assertThat(result.getUuid(), equalTo(PRACTITIONER_UUID));
}
use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.
the class PractitionerTranslatorProviderImplTest method shouldTranslateFhirContactPointToPersonAttribute.
@Test
public void shouldTranslateFhirContactPointToPersonAttribute() {
ProviderAttributeType attributeType = new ProviderAttributeType();
attributeType.setName(PERSON_ATTRIBUTE_TYPE_NAME);
attributeType.setUuid(PERSON_ATTRIBUTE_TYPE_UUID);
ProviderAttribute providerAttribute = new ProviderAttribute();
providerAttribute.setUuid(PERSON_ATTRIBUTE_UUID);
providerAttribute.setValue(PERSON_ATTRIBUTE_VALUE);
providerAttribute.setAttributeType(attributeType);
ContactPoint contactPoint = new ContactPoint();
contactPoint.setId(PERSON_ATTRIBUTE_UUID);
contactPoint.setValue(PERSON_ATTRIBUTE_VALUE);
practitioner.addTelecom(contactPoint);
when(telecomTranslator.toOpenmrsType(any(), any())).thenReturn(providerAttribute);
Provider provider = practitionerTranslator.toOpenmrsType(practitioner);
assertThat(provider, notNullValue());
assertThat(provider.getAttributes(), notNullValue());
assertThat(provider.getAttributes().size(), greaterThanOrEqualTo(1));
}
use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.
the class PractitionerTranslatorProviderImplTest method shouldReturnNullWhenProviderIsNull.
@Test
public void shouldReturnNullWhenProviderIsNull() {
Practitioner practitioner = practitionerTranslator.toFhirResource(null);
assertThat(practitioner, nullValue());
}
use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.
the class BaseFhirProvenanceResourceTest method addAgent.
private Provenance.ProvenanceAgentComponent addAgent() {
User user = new User();
user.setUuid(PRACTITIONER_UUID);
Practitioner practitioner = new Practitioner();
practitioner.setId(PRACTITIONER_UUID);
when(practitionerReferenceTranslator.toFhirResource(user)).thenReturn(createPractitionerReference());
return new Provenance.ProvenanceAgentComponent().setType(addAgentType()).addRole(addAgentRole()).setWho(practitionerReferenceTranslator.toFhirResource(user));
}
Aggregations