Search in sources :

Example 1 with POCDMT000002UK01OrganizationPartOf

use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01OrganizationPartOf in project integration-adaptor-111 by nhsconnect.

the class LocationMapperTest method shouldMapOrganizationToLocationComponent.

@Test
public void shouldMapOrganizationToLocationComponent() {
    POCDMT000002UK01Organization itkOrganization = mock(POCDMT000002UK01Organization.class);
    POCDMT000002UK01OrganizationPartOf partOf = mock(POCDMT000002UK01OrganizationPartOf.class);
    IVLTS effectiveTime = mock(IVLTS.class);
    when(organizationMapper.mapOrganization(any(POCDMT000002UK01Organization.class))).thenReturn(organization);
    when(itkOrganization.isSetAsOrganizationPartOf()).thenReturn(true);
    when(itkOrganization.getAsOrganizationPartOf()).thenReturn(partOf);
    when(partOf.getEffectiveTime()).thenReturn(effectiveTime);
    when(periodMapper.mapPeriod(any())).thenReturn(period);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    Encounter.EncounterLocationComponent encounterLocationComponent = locationMapper.mapOrganizationToLocationComponent(itkOrganization);
    assertThat(encounterLocationComponent.getLocationTarget().getIdElement().getValue()).isEqualTo(RANDOM_UUID);
    assertThat(encounterLocationComponent.getLocationTarget().getManagingOrganizationTarget()).isEqualTo(organization);
    assertThat(encounterLocationComponent.getPeriod()).isEqualTo(period);
}
Also used : IVLTS(uk.nhs.connect.iucds.cda.ucr.IVLTS) Encounter(org.hl7.fhir.dstu3.model.Encounter) POCDMT000002UK01OrganizationPartOf(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01OrganizationPartOf) POCDMT000002UK01Organization(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization) IdType(org.hl7.fhir.dstu3.model.IdType) Test(org.junit.jupiter.api.Test)

Aggregations

Encounter (org.hl7.fhir.dstu3.model.Encounter)1 IdType (org.hl7.fhir.dstu3.model.IdType)1 Test (org.junit.jupiter.api.Test)1 IVLTS (uk.nhs.connect.iucds.cda.ucr.IVLTS)1 POCDMT000002UK01Organization (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Organization)1 POCDMT000002UK01OrganizationPartOf (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01OrganizationPartOf)1