use of org.hl7.fhir.dstu2.model.ContactPoint in project openmrs-module-fhir2 by openmrs.
the class TelecomTranslatorImplTest method shouldUpdatePersonAttributeUuid.
@Test
public void shouldUpdatePersonAttributeUuid() {
PersonAttribute personAttribute = new PersonAttribute();
personAttribute.setUuid(PERSON_ATTRIBUTE_UUID);
ContactPoint contactPoint = new ContactPoint();
contactPoint.setId(NEW_PERSON_ATTRIBUTE_UUID);
PersonAttribute result = (PersonAttribute) telecomTranslator.toOpenmrsType(personAttribute, contactPoint);
assertThat(result, notNullValue());
assertThat(result.getUuid(), notNullValue());
assertThat(result.getUuid(), equalTo(NEW_PERSON_ATTRIBUTE_UUID));
}
use of org.hl7.fhir.dstu2.model.ContactPoint in project openmrs-module-fhir2 by openmrs.
the class TelecomTranslatorImplTest method shouldUpdateProviderAttributeValue.
@Test
public void shouldUpdateProviderAttributeValue() {
ProviderAttribute providerAttribute = new ProviderAttribute();
providerAttribute.setValue(PROVIDER_ATTRIBUTE_VALUE);
ContactPoint contactPoint = new ContactPoint();
contactPoint.setValue(NEW_PROVIDER_ATTRIBUTE_VALUE);
ProviderAttribute result = (ProviderAttribute) telecomTranslator.toOpenmrsType(providerAttribute, contactPoint);
assertThat(result, notNullValue());
assertThat(result.getValue(), notNullValue());
assertThat(result.getValue(), equalTo(NEW_PROVIDER_ATTRIBUTE_VALUE));
}
use of org.hl7.fhir.dstu2.model.ContactPoint in project openmrs-module-fhir2 by openmrs.
the class TelecomTranslatorImplTest method shouldTranslateFhirContactPointValueToPersonAttributeValue.
@Test
public void shouldTranslateFhirContactPointValueToPersonAttributeValue() {
ContactPoint contactPoint = new ContactPoint();
contactPoint.setValue(CONTACT_POINT_VALUE);
PersonAttribute result = (PersonAttribute) telecomTranslator.toOpenmrsType(new PersonAttribute(), contactPoint);
assertThat(result, notNullValue());
assertThat(result.getValue(), equalTo(CONTACT_POINT_VALUE));
}
use of org.hl7.fhir.dstu2.model.ContactPoint in project openmrs-module-fhir2 by openmrs.
the class TelecomTranslatorImplTest method shouldUpdateProviderAttributeWithTheCorrectPersonAttributeTypeUuid.
@Test
public void shouldUpdateProviderAttributeWithTheCorrectPersonAttributeTypeUuid() {
ProviderAttribute providerAttribute = new ProviderAttribute();
providerAttribute.setUuid(PERSON_ATTRIBUTE_UUID);
providerAttribute.setValue(PERSON_ATTRIBUTE_VALUE);
ProviderAttributeType attributeType = new ProviderAttributeType();
attributeType.setName(ATTRIBUTE_TYPE_NAME);
attributeType.setUuid(PERSON_ATTRIBUTE_TYPE_UUID);
providerAttribute.setAttributeType(attributeType);
ContactPoint contactPoint = new ContactPoint();
contactPoint.setId(NEW_PERSON_ATTRIBUTE_UUID);
contactPoint.setValue(NEW_PERSON_ATTRIBUTE_VALUE);
when(globalPropertyService.getGlobalProperty(FhirConstants.PROVIDER_CONTACT_POINT_ATTRIBUTE_TYPE)).thenReturn(PROVIDER_ATTRIBUTE_TYPE_UUID);
when(providerService.getProviderAttributeTypeByUuid(PROVIDER_ATTRIBUTE_TYPE_UUID)).thenReturn(attributeType);
ProviderAttribute result = (ProviderAttribute) telecomTranslator.toOpenmrsType(providerAttribute, contactPoint);
assertThat(result, notNullValue());
assertThat(result.getValue(), notNullValue());
assertThat(result.getAttributeType().getUuid(), equalTo(PROVIDER_ATTRIBUTE_TYPE_UUID));
}
use of org.hl7.fhir.dstu2.model.ContactPoint in project openmrs-module-fhir2 by openmrs.
the class TelecomTranslatorImplTest method shouldTranslatePersonAttributeUuidToFhirContactPointId.
@Test
public void shouldTranslatePersonAttributeUuidToFhirContactPointId() {
PersonAttribute personAttribute = new PersonAttribute();
personAttribute.setUuid(PERSON_ATTRIBUTE_UUID);
ContactPoint contactPoint = telecomTranslator.toFhirResource(personAttribute);
assertThat(contactPoint, notNullValue());
assertThat(contactPoint.getId(), equalTo(PERSON_ATTRIBUTE_UUID));
}
Aggregations