use of com.adobe.target.delivery.v1.model.Address in project openmrs-module-fhir2 by openmrs.
the class PersonAddressTranslatorImplTest method shouldConvertAddressToPersonAddress.
@Test
public void shouldConvertAddressToPersonAddress() {
Address address = new Address();
address.setId(PERSON_ADDRESS_UUID);
PersonAddress result = addressTranslator.toOpenmrsType(address);
assertThat(result, notNullValue());
assertThat(result.getUuid(), equalTo(PERSON_ADDRESS_UUID));
}
use of com.adobe.target.delivery.v1.model.Address in project openmrs-module-fhir2 by openmrs.
the class PersonAddressTranslatorImplTest method shouldConvertStateToStateProvince.
@Test
public void shouldConvertStateToStateProvince() {
Address address = new Address();
address.setState(PROVINCE);
assertThat(addressTranslator.toOpenmrsType(address).getStateProvince(), equalTo(PROVINCE));
}
use of com.adobe.target.delivery.v1.model.Address in project openmrs-module-fhir2 by openmrs.
the class PractitionerTranslatorProviderImplTest method shouldTranslateProviderAddressToFhirPractitionerAddressType.
@Test
public void shouldTranslateProviderAddressToFhirPractitionerAddressType() {
Person person = new Person();
PersonAddress personAddress = new PersonAddress();
personAddress.setCityVillage(CITY_VILLAGE);
personAddress.setCountry(COUNTRY);
person.addAddress(personAddress);
provider.setPerson(person);
Address fhirAddress = new Address();
fhirAddress.setCity(CITY_VILLAGE);
fhirAddress.setCountry(COUNTRY);
when(addressTranslator.toFhirResource(personAddress)).thenReturn(fhirAddress);
Practitioner practitioner = practitionerTranslator.toFhirResource(provider);
assertThat(practitioner, notNullValue());
assertThat(practitioner.getAddress(), not(empty()));
assertThat(practitioner.getAddress().get(0).getCountry(), equalTo(COUNTRY));
assertThat(practitioner.getAddress().get(0).getCity(), equalTo(CITY_VILLAGE));
}
use of com.adobe.target.delivery.v1.model.Address in project openmrs-module-fhir2 by openmrs.
the class PractitionerTranslatorProviderImplTest method shouldTranslateFhirAddressToPersonAddress.
@Test
public void shouldTranslateFhirAddressToPersonAddress() {
PersonAddress personAddress = new PersonAddress();
personAddress.setUuid(ADDRESS_UUID);
personAddress.setCityVillage(ADDRESS_CITY);
org.hl7.fhir.r4.model.Practitioner practitioner = new org.hl7.fhir.r4.model.Practitioner();
practitioner.addIdentifier(new Identifier().setValue("349023n23b-t"));
Address address = practitioner.addAddress();
address.setId(ADDRESS_UUID);
address.setCity(ADDRESS_CITY);
when(addressTranslator.toOpenmrsType(address)).thenReturn(personAddress);
Provider result = practitionerTranslator.toOpenmrsType(practitioner);
assertThat(result, notNullValue());
assertThat(result.getPerson().getPersonAddress(), notNullValue());
assertThat(result.getPerson().getPersonAddress().getUuid(), equalTo(ADDRESS_UUID));
assertThat(result.getPerson().getPersonAddress().getCityVillage(), equalTo(ADDRESS_CITY));
}
use of com.adobe.target.delivery.v1.model.Address in project openmrs-module-fhir2 by openmrs.
the class PatientTranslatorImplTest method shouldTranslateFhirAddressToOpenMRSAddress.
@Test
public void shouldTranslateFhirAddressToOpenMRSAddress() {
PersonAddress personAddress = new PersonAddress();
personAddress.setUuid(ADDRESS_UUID);
personAddress.setCityVillage(ADDRESS_CITY);
when(addressTranslator.toOpenmrsType(argThat(hasProperty("id", equalTo(ADDRESS_UUID))))).thenReturn(personAddress);
Patient patient = new Patient();
Address address = new Address();
address.setId(ADDRESS_UUID);
address.setCity(ADDRESS_CITY);
patient.addAddress(address);
org.openmrs.Patient result = patientTranslator.toOpenmrsType(patient);
assertThat(result.getAddresses(), not(empty()));
assertThat(result.getAddresses(), hasItem(hasProperty("uuid", equalTo(ADDRESS_UUID))));
assertThat(result.getAddresses(), hasItem(hasProperty("cityVillage", equalTo(ADDRESS_CITY))));
}
Aggregations