Search in sources :

Example 91 with Address

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));
}
Also used : Practitioner(org.hl7.fhir.r4.model.Practitioner) PersonAddress(org.openmrs.PersonAddress) Address(org.hl7.fhir.r4.model.Address) PersonAddress(org.openmrs.PersonAddress) Person(org.openmrs.Person) Test(org.junit.Test)

Example 92 with Address

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));
}
Also used : RelatedPerson(org.hl7.fhir.r4.model.RelatedPerson) Address(org.hl7.fhir.r4.model.Address) PersonAddress(org.openmrs.PersonAddress) PersonAddress(org.openmrs.PersonAddress) Test(org.junit.Test)

Example 93 with 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));
}
Also used : Address(org.hl7.fhir.r4.model.Address) Address(org.hl7.fhir.r4.model.Address) Location(org.openmrs.Location) Test(org.junit.Test)

Example 94 with Address

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));
}
Also used : Address(org.hl7.fhir.r4.model.Address) Test(org.junit.Test)

Example 95 with Address

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());
}
Also used : Address(org.hl7.fhir.r4.model.Address) Test(org.junit.Test)

Aggregations

Address (org.hl7.fhir.r4.model.Address)75 Test (org.junit.Test)35 Address (org.hl7.fhir.dstu3.model.Address)22 PersonAddress (org.openmrs.PersonAddress)21 HumanName (org.hl7.fhir.r4.model.HumanName)20 Patient (org.hl7.fhir.r4.model.Patient)18 ArrayList (java.util.ArrayList)17 Identifier (org.hl7.fhir.r4.model.Identifier)17 ContactPoint (org.hl7.fhir.r4.model.ContactPoint)16 Test (org.junit.jupiter.api.Test)13 Organization (org.hl7.fhir.r4.model.Organization)12 Address (com.amazonaws.services.ec2.model.Address)7 HumanName (org.hl7.fhir.dstu3.model.HumanName)7 PatientCommunicationComponent (org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent)7 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6 DescribeAddressesResult (com.amazonaws.services.ec2.model.DescribeAddressesResult)5 HashSet (java.util.HashSet)5 Coding (org.hl7.fhir.r4.model.Coding)5 StringType (org.hl7.fhir.r4.model.StringType)5 Before (org.junit.Before)5