use of com.adobe.target.delivery.v1.model.Address in project openmrs-module-fhir2 by openmrs.
the class PractitionerTranslatorUserImplTest method shouldTranslateUserAddressToFhirPractitionerAddressType.
@Test
public void shouldTranslateUserAddressToFhirPractitionerAddressType() {
Person person = new Person();
PersonAddress personAddress = new PersonAddress();
personAddress.setCityVillage(CITY_VILLAGE);
personAddress.setCountry(COUNTRY);
person.addAddress(personAddress);
user.setPerson(person);
Address fhirAddress = new Address();
fhirAddress.setCity(CITY_VILLAGE);
fhirAddress.setCountry(COUNTRY);
when(addressTranslator.toFhirResource(personAddress)).thenReturn(fhirAddress);
Practitioner practitioner = practitionerTranslatorUser.toFhirResource(user);
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 RelatedPersonTranslatorImplTest method shouldTranslateRelationshipPersonAAddressToFhirAddress.
@Test
public void shouldTranslateRelationshipPersonAAddressToFhirAddress() {
Address address = new Address();
address.setId(ADDRESS_UUID);
address.setCity(ADDRESS_CITY);
when(addressTranslator.toFhirResource(argThat(allOf(hasProperty("uuid", equalTo(ADDRESS_UUID)), hasProperty("cityVillage", equalTo(ADDRESS_CITY)))))).thenReturn(address);
PersonAddress personAddress = new PersonAddress();
personAddress.setUuid(ADDRESS_UUID);
personAddress.setCityVillage(ADDRESS_CITY);
personA.addAddress(personAddress);
relationship.setPersonA(personA);
org.hl7.fhir.r4.model.RelatedPerson result = relatedPersonTranslator.toFhirResource(relationship);
assertThat(result.getAddress(), notNullValue());
assertThat(result.getAddress(), not(empty()));
assertThat(result.getAddress().get(0), equalTo(address));
}
use of com.adobe.target.delivery.v1.model.Address in project openmrs-module-fhir2 by openmrs.
the class LocationAddressTranslatorImplTest method shouldTranslateAddressCityToLocationCity.
@Test
public void shouldTranslateAddressCityToLocationCity() {
org.hl7.fhir.r4.model.Address address = new Address();
address.setCity(CITY);
omrsLocation = translator.toOpenmrsType(new Location(), address);
assertThat(omrsLocation, notNullValue());
assertThat(omrsLocation.getCityVillage(), notNullValue());
assertThat(omrsLocation.getCityVillage(), equalTo(CITY));
}
use of com.adobe.target.delivery.v1.model.Address in project openmrs-module-fhir2 by openmrs.
the class LocationAddressTranslatorImplTest method shouldTranslateLocationCityVillageToAddressCity.
@Test
public void shouldTranslateLocationCityVillageToAddressCity() {
omrsLocation.setCityVillage(CITY);
org.hl7.fhir.r4.model.Address address = translator.toFhirResource(omrsLocation);
assertThat(address, notNullValue());
assertThat(address.getCity(), notNullValue());
assertThat(address.getCity(), equalTo(CITY));
}
use of com.adobe.target.delivery.v1.model.Address in project openmrs-module-fhir2 by openmrs.
the class LocationAddressTranslatorImplTest method toFhirResource_shouldReturnNullIfCalledWithoutLocation.
@Test
public void toFhirResource_shouldReturnNullIfCalledWithoutLocation() {
Address address = translator.toFhirResource(null);
assertThat(address, nullValue());
}
Aggregations