Search in sources :

Example 76 with Practitioner

use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.

the class PractitionerTranslatorUserImplTest method shouldTranslateUserGenderToFhirPractitionerGender.

@Test
public void shouldTranslateUserGenderToFhirPractitionerGender() {
    Person person = new Person();
    person.setGender(GENDER);
    user.setPerson(person);
    when(genderTranslator.toFhirResource(GENDER)).thenReturn(Enumerations.AdministrativeGender.MALE);
    Practitioner practitioner = practitionerTranslatorUser.toFhirResource(user);
    assertThat(practitioner, notNullValue());
    assertThat(practitioner.getGender(), notNullValue());
    assertThat(practitioner.getGender(), equalTo(Enumerations.AdministrativeGender.MALE));
}
Also used : Practitioner(org.hl7.fhir.r4.model.Practitioner) Person(org.openmrs.Person) Test(org.junit.Test)

Example 77 with Practitioner

use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.

the class PractitionerTranslatorUserImplTest method shouldTranslateOpenMrsUserToFhirPractitioner.

@Test
public void shouldTranslateOpenMrsUserToFhirPractitioner() {
    Practitioner practitioner = practitionerTranslatorUser.toFhirResource(user);
    assertThat(practitioner, notNullValue());
}
Also used : Practitioner(org.hl7.fhir.r4.model.Practitioner) Test(org.junit.Test)

Example 78 with Practitioner

use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.

the class PractitionerTranslatorUserImplTest method shouldTranslateUserUuidToFhirPractitionerId.

@Test
public void shouldTranslateUserUuidToFhirPractitionerId() {
    Practitioner practitioner = practitionerTranslatorUser.toFhirResource(user);
    assertThat(practitioner, notNullValue());
    assertThat(practitioner.getId(), notNullValue());
    assertThat(practitioner.getId(), equalTo(USER_UUID));
}
Also used : Practitioner(org.hl7.fhir.r4.model.Practitioner) Test(org.junit.Test)

Example 79 with Practitioner

use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.

the class PractitionerReferenceTranslatorUserImplTest method toOpenmrsType_shouldConvertReferenceToUser.

@Test
public void toOpenmrsType_shouldConvertReferenceToUser() {
    Reference creatorReference = new Reference().setReference(FhirConstants.PRACTITIONER + "/" + USER_UUID).setType(FhirConstants.PRACTITIONER);
    User user = new User();
    user.setUuid(USER_UUID);
    Practitioner practitioner = new Practitioner();
    practitioner.setId(PRACTITIONER_UUID);
    when(userDao.get(USER_UUID)).thenReturn(user);
    User result = practitionerReferenceTranslatorUser.toOpenmrsType(creatorReference);
    assertThat(result, Matchers.notNullValue());
    assertThat(result.getUuid(), Matchers.equalTo(USER_UUID));
}
Also used : Practitioner(org.hl7.fhir.r4.model.Practitioner) User(org.openmrs.User) Reference(org.hl7.fhir.r4.model.Reference) Test(org.junit.Test)

Example 80 with Practitioner

use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.

the class PractitionerTranslatorProviderImplTest method setUp.

@Before
public void setUp() {
    practitionerTranslator = new PractitionerTranslatorProviderImpl();
    practitionerTranslator.setAddressTranslator(addressTranslator);
    practitionerTranslator.setGenderTranslator(genderTranslator);
    practitionerTranslator.setNameTranslator(nameTranslator);
    practitionerTranslator.setTelecomTranslator(telecomTranslator);
    practitionerTranslator.setFhirPractitionerDao(fhirPractitionerDao);
    practitionerTranslator.setGlobalPropertyService(globalPropertyService);
    practitionerTranslator.setProvenanceTranslator(provenanceTranslator);
    practitionerTranslator.setBirthDateTranslator(birthDateTranslator);
    Person person = new Person();
    person.setGender(GENDER);
    provider = new Provider();
    provider.setUuid(PROVIDER_UUID);
    provider.setPerson(person);
    practitioner = new Practitioner();
    practitioner.setId(PRACTITIONER_UUID);
    Identifier identifier = new Identifier();
    identifier.setValue(PRACTITIONER_IDENTIFIER);
    practitioner.addIdentifier();
}
Also used : Practitioner(org.hl7.fhir.r4.model.Practitioner) Identifier(org.hl7.fhir.r4.model.Identifier) Person(org.openmrs.Person) Provider(org.openmrs.Provider) Before(org.junit.Before)

Aggregations

Test (org.junit.Test)185 Practitioner (org.hl7.fhir.r4.model.Practitioner)139 IBundleProvider (ca.uhn.fhir.rest.api.server.IBundleProvider)86 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)81 Test (org.junit.jupiter.api.Test)68 Practitioner (org.hl7.fhir.dstu3.model.Practitioner)62 SearchParameterMap (org.openmrs.module.fhir2.api.search.param.SearchParameterMap)59 StringAndListParam (ca.uhn.fhir.rest.param.StringAndListParam)54 StringParam (ca.uhn.fhir.rest.param.StringParam)54 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)52 BaseModuleContextSensitiveTest (org.openmrs.test.BaseModuleContextSensitiveTest)37 Identifier (org.hl7.fhir.r4.model.Identifier)32 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)30 Resource (org.hl7.fhir.r4.model.Resource)30 ArrayList (java.util.ArrayList)25 Reference (org.hl7.fhir.r4.model.Reference)24 Bundle (org.hl7.fhir.r4.model.Bundle)22 Date (java.util.Date)21 List (java.util.List)21 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)20