Search in sources :

Example 36 with Address

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

Example 37 with Address

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

Example 38 with Address

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

Example 39 with Address

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

Example 40 with Address

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

Aggregations

Address (org.hl7.fhir.r4.model.Address)75 Test (org.junit.Test)47 Patient (org.hl7.fhir.r4.model.Patient)30 Test (org.junit.jupiter.api.Test)30 PersonAddress (org.openmrs.PersonAddress)27 HumanName (org.hl7.fhir.r4.model.HumanName)24 Identifier (org.hl7.fhir.r4.model.Identifier)23 ArrayList (java.util.ArrayList)22 Address (org.hl7.fhir.dstu3.model.Address)22 Path (javax.ws.rs.Path)20 Produces (javax.ws.rs.Produces)20 NotImplementedException (org.apache.commons.lang3.NotImplementedException)19 ContactPoint (org.hl7.fhir.r4.model.ContactPoint)19 Location (org.hl7.fhir.r4.model.Location)13 Organization (org.hl7.fhir.r4.model.Organization)13 InputStream (java.io.InputStream)12 IdType (org.hl7.fhir.dstu3.model.IdType)12 Patient (org.hl7.fhir.dstu3.model.Patient)12 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)12 BaseModuleContextSensitiveTest (org.openmrs.test.BaseModuleContextSensitiveTest)12