use of org.hl7.fhir.dstu2016may.model.Address in project openmrs-module-fhir2 by openmrs.
the class PersonAddressTranslatorImplTest method shouldConvertPersonAddressToAddress.
@Test
public void shouldConvertPersonAddressToAddress() {
PersonAddress address = new PersonAddress();
address.setUuid(PERSON_ADDRESS_UUID);
Address result = addressTranslator.toFhirResource(address);
assertThat(result, notNullValue());
assertThat(result.getId(), equalTo(PERSON_ADDRESS_UUID));
}
use of org.hl7.fhir.dstu2016may.model.Address in project openmrs-module-fhir2 by openmrs.
the class PersonAddressTranslatorImplTest method shouldConvertOldAddressToNotPreferred.
@Test
public void shouldConvertOldAddressToNotPreferred() {
Address address = new Address();
address.setUse(Address.AddressUse.OLD);
assertThat(addressTranslator.toOpenmrsType(address).getPreferred(), is(false));
}
use of org.hl7.fhir.dstu2016may.model.Address in project openmrs-module-fhir2 by openmrs.
the class PersonAddressTranslatorImplTest method shouldConvertCityToCityVillage.
@Test
public void shouldConvertCityToCityVillage() {
Address address = new Address();
address.setCity(CITY);
assertThat(addressTranslator.toOpenmrsType(address).getCityVillage(), equalTo(CITY));
}
use of org.hl7.fhir.dstu2016may.model.Address in project openmrs-module-fhir2 by openmrs.
the class PersonAddressTranslatorImplTest method shouldConvertHomeAddressToPreferred.
@Test
public void shouldConvertHomeAddressToPreferred() {
Address address = new Address();
address.setUse(Address.AddressUse.HOME);
assertThat(addressTranslator.toOpenmrsType(address).getPreferred(), is(true));
}
use of org.hl7.fhir.dstu2016may.model.Address in project openmrs-module-fhir2 by openmrs.
the class PersonTranslatorImplTest method shouldTranslateFhirAddressToPersonAddress.
@Test
public void shouldTranslateFhirAddressToPersonAddress() {
PersonAddress personAddress = new PersonAddress();
personAddress.setUuid(ADDRESS_UUID);
personAddress.setCityVillage(ADDRESS_CITY);
org.hl7.fhir.r4.model.Person person = new org.hl7.fhir.r4.model.Person();
Address address = person.addAddress();
address.setId(ADDRESS_UUID);
address.setCity(ADDRESS_CITY);
when(addressTranslator.toOpenmrsType(address)).thenReturn(personAddress);
Person result = personTranslator.toOpenmrsType(person);
assertThat(result, notNullValue());
assertThat(result.getPersonAddress(), notNullValue());
assertThat(result.getPersonAddress().getUuid(), equalTo(ADDRESS_UUID));
assertThat(result.getPersonAddress().getCityVillage(), equalTo(ADDRESS_CITY));
}
Aggregations