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);
}
Aggregations