Search in sources :

Example 91 with org.hl7.fhir.r5.model

use of org.hl7.fhir.r5.model in project openmrs-module-fhir2 by openmrs.

the class LocationAddressTranslatorImplTest method shouldTranslateLocationProvinceToAddressProvince.

@Test
public void shouldTranslateLocationProvinceToAddressProvince() {
    omrsLocation.setStateProvince(STATE_PROVINCE);
    org.hl7.fhir.r4.model.Address address = translator.toFhirResource(omrsLocation);
    assertThat(address, notNullValue());
    assertThat(address.getState(), notNullValue());
    assertThat(address.getState(), equalTo(STATE_PROVINCE));
}
Also used : Address(org.hl7.fhir.r4.model.Address) Test(org.junit.Test)

Example 92 with org.hl7.fhir.r5.model

use of org.hl7.fhir.r5.model in project openmrs-module-fhir2 by openmrs.

the class LocationAddressTranslatorImplTest method shouldTranslateLocationCountryToAddressCountry.

@Test
public void shouldTranslateLocationCountryToAddressCountry() {
    omrsLocation.setCountry(COUNTRY);
    org.hl7.fhir.r4.model.Address address = translator.toFhirResource(omrsLocation);
    assertThat(address, notNullValue());
    assertThat(address.getCountry(), notNullValue());
    assertThat(address.getCountry(), equalTo(COUNTRY));
}
Also used : Address(org.hl7.fhir.r4.model.Address) Test(org.junit.Test)

Example 93 with org.hl7.fhir.r5.model

use of org.hl7.fhir.r5.model in project openmrs-module-fhir2 by openmrs.

the class LocationAddressTranslatorImplTest method shouldTranslateAddressStateToLocationState.

@Test
public void shouldTranslateAddressStateToLocationState() {
    org.hl7.fhir.r4.model.Address address = new Address();
    address.setState(STATE_PROVINCE);
    omrsLocation = translator.toOpenmrsType(new Location(), address);
    assertThat(omrsLocation, notNullValue());
    assertThat(omrsLocation.getStateProvince(), notNullValue());
    assertThat(omrsLocation.getStateProvince(), equalTo(STATE_PROVINCE));
}
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 org.hl7.fhir.r5.model

use of org.hl7.fhir.r5.model in project openmrs-module-fhir2 by openmrs.

the class LocationTranslatorImplTest method shouldTranslateLocationAttributeToFhirContactPoint.

@Test
public void shouldTranslateLocationAttributeToFhirContactPoint() {
    ContactPoint contactPoint = new ContactPoint();
    contactPoint.setId(CONTACT_POINT_ID);
    contactPoint.setValue(CONTACT_POINT_VALUE);
    LocationAttribute locationAttribute = new LocationAttribute();
    locationAttribute.setUuid(LOCATION_ATTRIBUTE_UUID);
    locationAttribute.setValue(LOCATION_ATTRIBUTE_VALUE);
    LocationAttributeType attributeType = new LocationAttributeType();
    attributeType.setName(LOCATION_ATTRIBUTE_TYPE_NAME);
    attributeType.setUuid(LOCATION_ATTRIBUTE_TYPE_UUID);
    locationAttribute.setAttributeType(attributeType);
    org.hl7.fhir.r4.model.Location location = locationTranslator.toFhirResource(new Location());
    assertThat(location, notNullValue());
    assertThat(location.getTelecom(), notNullValue());
}
Also used : ContactPoint(org.hl7.fhir.r4.model.ContactPoint) LocationAttribute(org.openmrs.LocationAttribute) LocationAttributeType(org.openmrs.LocationAttributeType) Location(org.openmrs.Location) Test(org.junit.Test)

Example 95 with org.hl7.fhir.r5.model

use of org.hl7.fhir.r5.model in project openmrs-module-fhir2 by openmrs.

the class LocationTranslatorImplTest method toOpenmrsType_shouldTranslateFhirTagsToOpenmrsLocationTags.

@Test
public void toOpenmrsType_shouldTranslateFhirTagsToOpenmrsLocationTags() {
    LocationTag omrsTag = new LocationTag(LAB_TAG_NAME, LAB_TAG_DESCRIPTION);
    List<Coding> tags = new ArrayList<>();
    Coding tag = new Coding();
    tag.setCode(LAB_TAG_NAME);
    tag.setDisplay(LAB_TAG_DESCRIPTION);
    tags.add(tag);
    org.hl7.fhir.r4.model.Location fhirLocation = new org.hl7.fhir.r4.model.Location();
    fhirLocation.getMeta().setTag(tags);
    when(locationTagTranslator.toOpenmrsType(tag)).thenReturn(omrsTag);
    omrsLocation = locationTranslator.toOpenmrsType(fhirLocation);
    assertThat(omrsLocation.getTags(), notNullValue());
    assertThat(omrsLocation.getTags(), hasSize(greaterThanOrEqualTo(1)));
    assertThat(omrsLocation.getTags().iterator().next().getName(), is(LAB_TAG_NAME));
}
Also used : LocationTag(org.openmrs.LocationTag) Coding(org.hl7.fhir.r4.model.Coding) ArrayList(java.util.ArrayList) Location(org.openmrs.Location) Test(org.junit.Test)

Aggregations

Test (org.junit.jupiter.api.Test)435 Turtle (org.hl7.fhir.dstu3.utils.formats.Turtle)334 Test (org.junit.Test)289 ArrayList (java.util.ArrayList)112 FHIRException (org.hl7.fhir.exceptions.FHIRException)111 IOException (java.io.IOException)84 List (java.util.List)73 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)70 Date (java.util.Date)68 FileOutputStream (java.io.FileOutputStream)66 File (java.io.File)61 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)61 CodeableReference (org.hl7.fhir.r5.model.CodeableReference)58 InputStream (java.io.InputStream)55 TableModel (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel)51 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)50 Bundle (org.hl7.fhir.dstu3.model.Bundle)49 IBundleProvider (ca.uhn.fhir.rest.api.server.IBundleProvider)48 Collectors (java.util.stream.Collectors)48 Arrays (java.util.Arrays)46