use of uk.nhs.connect.iucds.cda.ucr.CE in project integration-adaptor-111 by nhsconnect.
the class RelatedPersonMapperTest method createCode.
private CE createCode() {
CE code = CE.Factory.newInstance();
code.setDisplayName(CODE_DISPLAY_NAME);
code.setCode(CODE);
code.setCodeSystem(CODE_SYSTEM);
return code;
}
use of uk.nhs.connect.iucds.cda.ucr.CE in project integration-adaptor-111 by nhsconnect.
the class PractitionerRoleMapperTest method mockAuthors.
private void mockAuthors() {
when(author.getTypeCode()).thenReturn(AUTHOR_TYPE_CODE);
POCDMT000002UK01AssignedAuthor assignedAuthor = mock(POCDMT000002UK01AssignedAuthor.class);
when(author.getAssignedAuthor()).thenReturn(assignedAuthor);
CE ce = mockCode();
when(assignedAuthor.getCode()).thenReturn(ce);
when(assignedAuthor.getRepresentedOrganization()).thenReturn(mock(POCDMT000002UK01Organization.class));
when(organizationMapper.mapOrganization(any(POCDMT000002UK01Organization.class))).thenReturn(organization);
when(practitionerMapper.mapPractitioner(any(POCDMT000002UK01AssignedAuthor.class))).thenReturn(practitioner);
}
use of uk.nhs.connect.iucds.cda.ucr.CE in project integration-adaptor-111 by nhsconnect.
the class PractitionerRoleMapperTest method mockCode.
private CE mockCode() {
CE ce = mock(CE.class);
when(ce.getCode()).thenReturn(CODE);
when(ce.getCodeSystem()).thenReturn(CODE_SYSTEM);
when(ce.getDisplayName()).thenReturn(DISPLAY_NAME);
return ce;
}
use of uk.nhs.connect.iucds.cda.ucr.CE in project integration-adaptor-111 by nhsconnect.
the class PractitionerRoleMapperTest method mockResponsibleParty.
private void mockResponsibleParty() {
when(clinicalDocument.isSetComponentOf()).thenReturn(true);
POCDMT000002UK01Component1 component1 = mock(POCDMT000002UK01Component1.class);
when(clinicalDocument.getComponentOf()).thenReturn(component1);
POCDMT000002UK01EncompassingEncounter encompassingEncounter = mock(POCDMT000002UK01EncompassingEncounter.class);
when(component1.getEncompassingEncounter()).thenReturn(encompassingEncounter);
when(encompassingEncounter.isSetResponsibleParty()).thenReturn(true);
POCDMT000002UK01ResponsibleParty responsibleParty = mock(POCDMT000002UK01ResponsibleParty.class);
when(encompassingEncounter.getResponsibleParty()).thenReturn(responsibleParty);
POCDMT000002UK01AssignedEntity assignedEntity = mock(POCDMT000002UK01AssignedEntity.class);
when(assignedEntity.isSetRepresentedOrganization()).thenReturn(true);
when(assignedEntity.getRepresentedOrganization()).thenReturn(mock(POCDMT000002UK01Organization.class));
CE ce = mockCode();
when(assignedEntity.getCode()).thenReturn(ce);
when(responsibleParty.getAssignedEntity()).thenReturn(assignedEntity);
when(organizationMapper.mapOrganization(any(POCDMT000002UK01Organization.class))).thenReturn(organization);
when(practitionerMapper.mapPractitioner(any(POCDMT000002UK01AssignedEntity.class))).thenReturn(practitioner);
}
use of uk.nhs.connect.iucds.cda.ucr.CE in project integration-adaptor-111 by nhsconnect.
the class OrganizationMapperTest method mockItkOrganization.
private POCDMT000002UK01Organization mockItkOrganization() {
POCDMT000002UK01Organization itkOrganization = mock(POCDMT000002UK01Organization.class);
AD itkAddress = mock(AD.class);
TEL itkTelecom = mock(TEL.class);
CE codeEntity = mock(CE.class);
II[] iiArray = new II[] { ii };
when(itkOrganization.getIdArray()).thenReturn(iiArray);
when(ii.isSetExtension()).thenReturn(true);
when(ii.getExtension()).thenReturn(ODS_CODE);
when(itkOrganization.sizeOfIdArray()).thenReturn(1);
when(itkOrganization.getAddrArray()).thenReturn(new AD[] { itkAddress });
when(itkOrganization.getTelecomArray()).thenReturn(new TEL[] { itkTelecom });
when(itkOrganization.isSetStandardIndustryClassCode()).thenReturn(true);
when(itkOrganization.getStandardIndustryClassCode()).thenReturn(codeEntity);
when(codeEntity.getDisplayName()).thenReturn(GP_PRACTICE);
when(contactPointMapper.mapContactPoint(any())).thenReturn(contactPoint);
when(addressMapper.mapAddress(any())).thenReturn(address);
when(nodeUtil.getNodeValueString(itkOrganization.getNameArray(0))).thenReturn(ORGANIZATION_NAME);
when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
Organization organization = organizationMapper.mapOrganization(itkOrganization);
assertThat(organization.getName()).isEqualTo(ORGANIZATION_NAME);
assertThat(organization.getAddressFirstRep()).isEqualTo(address);
assertThat(organization.getTelecomFirstRep()).isEqualTo(contactPoint);
assertThat(organization.getTypeFirstRep().getText()).isEqualTo(GP_PRACTICE);
assertThat(organization.getIdentifierFirstRep().getValue()).isEqualTo(ODS_CODE);
assertThat(organization.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
return itkOrganization;
}
Aggregations