Search in sources :

Example 1 with POCDMT000002UK01AssociatedEntity

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

the class ParticipantMapperTest method shouldMapParticipant.

@Test
public void shouldMapParticipant() {
    POCDMT000002UK01Participant1 encounterParticipant = mock(POCDMT000002UK01Participant1.class);
    POCDMT000002UK01AssociatedEntity associatedEntity = mock(POCDMT000002UK01AssociatedEntity.class);
    IVLTS time = mock(IVLTS.class);
    when(encounterParticipant.getTypeCode()).thenReturn("CON");
    when(encounterParticipant.getAssociatedEntity()).thenReturn(associatedEntity);
    when(encounterParticipant.isSetTime()).thenReturn(true);
    when(encounterParticipant.getTime()).thenReturn(time);
    when(periodMapper.mapPeriod(ArgumentMatchers.isA(IVLTS.class))).thenReturn(period);
    when(practitionerMapper.mapPractitioner(ArgumentMatchers.isA(POCDMT000002UK01AssociatedEntity.class))).thenReturn(practitioner);
    when(resourceUtil.createReference(practitioner)).thenReturn(new Reference(practitioner));
    Encounter.EncounterParticipantComponent participantComponent = participantMapper.mapEncounterParticipant(encounterParticipant);
    assertThat(participantComponent.getIndividualTarget()).isEqualTo(practitioner);
    assertThat(participantComponent.getPeriod()).isEqualTo(period);
    assertThat(participantComponent.getType().get(0).getText()).isEqualTo("CON");
}
Also used : IVLTS(uk.nhs.connect.iucds.cda.ucr.IVLTS) Reference(org.hl7.fhir.dstu3.model.Reference) POCDMT000002UK01Participant1(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Participant1) Encounter(org.hl7.fhir.dstu3.model.Encounter) POCDMT000002UK01AssociatedEntity(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssociatedEntity) Test(org.junit.jupiter.api.Test)

Example 2 with POCDMT000002UK01AssociatedEntity

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

the class PractitionerMapperTest method shouldMapPractitionerFromAssociatedEntity.

@Test
public void shouldMapPractitionerFromAssociatedEntity() {
    POCDMT000002UK01AssociatedEntity associatedEntity = POCDMT000002UK01AssociatedEntity.Factory.newInstance();
    associatedEntity.setAssociatedPerson(createPerson());
    associatedEntity.setTelecomArray(createTelecomArray());
    associatedEntity.setAddrArray(createAddrArray());
    when(humanNameMapper.mapHumanName(ArgumentMatchers.any())).thenReturn(humanName);
    when(contactPointMapper.mapContactPoint(ArgumentMatchers.any())).thenReturn(contactPoint);
    when(addressMapper.mapAddress(ArgumentMatchers.any())).thenReturn(address);
    when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
    Practitioner practitioner = practitionerMapper.mapPractitioner(associatedEntity);
    assertThat(practitioner.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
    assertThat(practitioner.getActive()).isEqualTo(true);
    assertThat(practitioner.getNameFirstRep()).isEqualTo(humanName);
    assertThat(practitioner.getTelecomFirstRep()).isEqualTo(contactPoint);
    assertThat(practitioner.getAddressFirstRep()).isEqualTo(address);
}
Also used : Practitioner(org.hl7.fhir.dstu3.model.Practitioner) POCDMT000002UK01AssociatedEntity(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssociatedEntity) IdType(org.hl7.fhir.dstu3.model.IdType) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)2 POCDMT000002UK01AssociatedEntity (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssociatedEntity)2 Encounter (org.hl7.fhir.dstu3.model.Encounter)1 IdType (org.hl7.fhir.dstu3.model.IdType)1 Practitioner (org.hl7.fhir.dstu3.model.Practitioner)1 Reference (org.hl7.fhir.dstu3.model.Reference)1 IVLTS (uk.nhs.connect.iucds.cda.ucr.IVLTS)1 POCDMT000002UK01Participant1 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Participant1)1