use of org.hl7.fhir.r4b.model.Address in project integration-adaptor-111 by nhsconnect.
the class PractitionerMapperTest method shouldMapPractitionerFromAssignedEntity.
@Test
public void shouldMapPractitionerFromAssignedEntity() {
POCDMT000002UK01AssignedEntity assignedEntity = POCDMT000002UK01AssignedEntity.Factory.newInstance();
assignedEntity.setAssignedPerson(createPerson());
assignedEntity.setTelecomArray(createTelecomArray());
assignedEntity.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(assignedEntity);
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);
}
use of org.hl7.fhir.r4b.model.Address in project integration-adaptor-111 by nhsconnect.
the class PractitionerMapperTest method shouldMapPractitionerForAssignedAuthor.
@Test
public void shouldMapPractitionerForAssignedAuthor() {
POCDMT000002UK01AssignedAuthor associatedEntity = POCDMT000002UK01AssignedAuthor.Factory.newInstance();
associatedEntity.setAssignedPerson(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);
}
use of org.hl7.fhir.r4b.model.Address in project integration-adaptor-111 by nhsconnect.
the class MessageHeaderServiceTest method shouldCreateMessageHeader.
@Test
public void shouldCreateMessageHeader() {
ItkReportHeader itkReportHeader = new ItkReportHeader();
itkReportHeader.setSpecKey(SPECIFICATION_KEY);
itkReportHeader.setSpecVal(SPECIFICATION_VALUE);
itkReportHeader.setAddressList(Arrays.asList(ADDRESS));
MessageHeader messageHeader = messageHeaderService.createMessageHeader(itkReportHeader, MESSAGEID, EFFECTIVE_TIME);
assertThat(messageHeader.getId()).isEqualTo(MESSAGEID);
Coding event = messageHeader.getEvent();
assertThat(event.getSystem()).isEqualTo(MessageHeaderEvent.SYSTEM);
assertThat(event.getCode()).isEqualTo(DISCHARGE_DETAILS.getCode());
assertThat(event.getDisplay()).isEqualTo(DISCHARGE_DETAILS.getDisplay());
MessageSourceComponent source = messageHeader.getSource();
assertThat(source.getName()).isEqualTo(MESSAGE_SOURCE_NAME);
assertThat(source.getEndpoint()).isEqualTo(ENDPOINT);
assertThat(messageHeader.getReason().getCodingFirstRep().getSystem()).isEqualTo(SPECIFICATION_KEY);
assertThat(messageHeader.getReason().getCodingFirstRep().getCode()).isEqualTo(SPECIFICATION_VALUE);
assertThat(messageHeader.getDestinationFirstRep().getEndpoint()).isEqualTo(ADDRESS);
assertThat(messageHeader.getTimestampElement()).isEqualToComparingFieldByField(DateUtil.parseToInstantType(EFFECTIVE_TIME));
}
use of org.hl7.fhir.r4b.model.Address in project integration-adaptor-111 by nhsconnect.
the class LocationMapperTest method shouldMapHealthcareFacilityToLocation.
@Test
public void shouldMapHealthcareFacilityToLocation() {
String locationName = "Moving castle";
AD itkAddress = mock(AD.class);
when(nodeUtil.getAllText(any())).thenReturn(locationName);
when(clinicalDocument.getComponentOf().getEncompassingEncounter().getLocation().getHealthCareFacility().getLocation().getAddr()).thenReturn(itkAddress);
when(addressMapper.mapAddress(eq(itkAddress))).thenReturn(address);
when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
Encounter.EncounterLocationComponent locationComponent = locationMapper.mapHealthcareFacilityToLocationComponent(clinicalDocument);
assertThat(locationComponent.getLocationTarget().getIdElement().getValue()).isEqualTo(RANDOM_UUID);
assertThat(locationComponent.getLocationTarget().getAddress()).isEqualTo(address);
assertThat(locationComponent.getLocationTarget().getName()).isEqualTo(locationName);
assertThat(locationComponent.getStatus()).isEqualTo(Encounter.EncounterLocationStatus.COMPLETED);
}
use of org.hl7.fhir.r4b.model.Address in project integration-adaptor-111 by nhsconnect.
the class LocationMapperTest method shouldMapRecipientToLocation.
@Test
public void shouldMapRecipientToLocation() {
POCDMT000002UK01IntendedRecipient itkIntendedRecipient = prepareIntendedRecipientMocks();
Location referenceRecipientToLocation = locationMapper.mapRecipientToLocation(itkIntendedRecipient, organization);
assertThat(referenceRecipientToLocation.getId()).isEqualTo(RANDOM_UUID);
assertThat(referenceRecipientToLocation.getAddress()).isEqualTo(address);
assertThat(referenceRecipientToLocation.getTelecom()).isEqualTo(List.of(contactPoint));
assertThat(referenceRecipientToLocation.getManagingOrganization()).isNotNull();
assertThat(referenceRecipientToLocation.getManagingOrganizationTarget()).isEqualTo(organization);
assertThat(referenceRecipientToLocation.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
}
Aggregations