Search in sources :

Example 36 with Location

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

the class BaseReferenceHandlingTranslatorTest method shouldAddLocationReference.

@Test
public void shouldAddLocationReference() {
    Reference reference = referenceHandlingTranslator.createLocationReference(location);
    assertThat(reference, notNullValue());
    assertThat(reference.getReference(), equalTo(LOCATION_URI));
    assertThat(reference.getType(), equalTo(FhirConstants.LOCATION));
    assertThat(reference.getDisplay(), equalTo(TEST_LOCATION_NAME));
}
Also used : Reference(org.hl7.fhir.r4.model.Reference) Test(org.junit.Test)

Example 37 with Location

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

the class EncounterLocationTranslatorImplTest method setUp.

@Before
public void setUp() {
    encounterLocationTranslator = new EncounterLocationTranslatorImpl();
    encounterLocationTranslator.setLocationDao(locationDao);
    location = new Location();
    location.setUuid(LOCATION_UUID);
    location.setName(TEST_LOCATION_NAME);
    encounterLocationComponent = new Encounter.EncounterLocationComponent();
    Reference reference = new Reference(LOCATION_URI);
    encounterLocationComponent.setLocation(reference);
}
Also used : Reference(org.hl7.fhir.r4.model.Reference) Encounter(org.hl7.fhir.r4.model.Encounter) Location(org.openmrs.Location) Before(org.junit.Before)

Example 38 with Location

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

the class EncounterTranslatorImplTest method toFhirResource_shouldTranslateToEncounterClassFhirType.

@Test
public void toFhirResource_shouldTranslateToEncounterClassFhirType() {
    when(encounterClassMap.getFhirClass(LOCATION_UUID)).thenReturn(TEST_FHIR_CLASS);
    omrsEncounter.setLocation(location);
    Encounter result = encounterTranslator.toFhirResource(omrsEncounter);
    assertThat(result, notNullValue());
    assertThat(result.getClass_(), notNullValue());
    assertThat(result.getClass_().getSystem(), is(FhirConstants.ENCOUNTER_CLASS_VALUE_SET_URI));
    assertThat(result.getClass_().getCode(), is(TEST_FHIR_CLASS));
}
Also used : Encounter(org.hl7.fhir.r4.model.Encounter) Test(org.junit.Test)

Example 39 with Location

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

the class LocationAddressTranslatorImplTest method shouldTranslateAddressPostalCodeToLocationPostalCode.

@Test
public void shouldTranslateAddressPostalCodeToLocationPostalCode() {
    org.hl7.fhir.r4.model.Address address = new Address();
    address.setPostalCode(POSTAL_CODE);
    omrsLocation = translator.toOpenmrsType(new Location(), address);
    assertThat(omrsLocation, notNullValue());
    assertThat(omrsLocation.getPostalCode(), notNullValue());
    assertThat(omrsLocation.getPostalCode(), equalTo(POSTAL_CODE));
}
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 40 with Location

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

the class LocationAddressTranslatorImplTest method shouldTranslateAddressCountryToLocationCountry.

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

Aggregations

Test (org.junit.Test)215 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)94 Location (org.hl7.fhir.r4.model.Location)93 IBundleProvider (ca.uhn.fhir.rest.api.server.IBundleProvider)71 Location (org.hl7.fhir.dstu3.model.Location)66 InputStream (java.io.InputStream)46 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)39 Matchers.containsString (org.hamcrest.Matchers.containsString)38 Test (org.junit.jupiter.api.Test)38 BaseModuleContextSensitiveTest (org.openmrs.test.BaseModuleContextSensitiveTest)37 SearchParameterMap (org.openmrs.module.fhir2.api.search.param.SearchParameterMap)35 ArrayList (java.util.ArrayList)29 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)29 BaseFhirProvenanceResourceTest (org.openmrs.module.fhir2.providers.BaseFhirProvenanceResourceTest)26 Reference (org.hl7.fhir.r4.model.Reference)25 Date (java.util.Date)24 Bundle (org.hl7.fhir.r4.model.Bundle)24 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)24 ReferenceAndListParam (ca.uhn.fhir.rest.param.ReferenceAndListParam)23 ReferenceOrListParam (ca.uhn.fhir.rest.param.ReferenceOrListParam)23