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