use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.
the class PractitionerFhirResourceProviderTest method findPractitionersByIdentifier_shouldReturnMatchingBundleOfPractitioners.
@Test
public void findPractitionersByIdentifier_shouldReturnMatchingBundleOfPractitioners() {
TokenAndListParam identifier = new TokenAndListParam().addAnd(new TokenOrListParam().add(PRACTITIONER_IDENTIFIER));
when(practitionerService.searchForPractitioners(argThat(is(identifier)), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull())).thenReturn(new MockIBundleProvider<>(Collections.singletonList(practitioner), PREFERRED_PAGE_SIZE, COUNT));
IBundleProvider results = practitionerService.searchForPractitioners(identifier, null, null, null, null, null, null, null, null, null, null);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList.iterator().next().fhirType(), is(FhirConstants.PRACTITIONER));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
}
use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.
the class PractitionerFhirResourceProviderTest method findPractitionersByName_shouldReturnMatchingBundleOfPractitioners.
@Test
public void findPractitionersByName_shouldReturnMatchingBundleOfPractitioners() {
StringAndListParam nameParam = new StringAndListParam().addAnd(new StringOrListParam().add(new StringParam(GIVEN_NAME)));
when(practitionerService.searchForPractitioners(isNull(), argThat(is(nameParam)), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull())).thenReturn(new MockIBundleProvider<>(Collections.singletonList(practitioner), PREFERRED_PAGE_SIZE, COUNT));
IBundleProvider results = resourceProvider.searchForPractitioners(nameParam, null, null, null, null, null, null, null, null, null, null);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList.iterator().next().fhirType(), is(FhirConstants.PRACTITIONER));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
}
use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.
the class PractitionerFhirResourceProviderTest method getPractitionerHistoryById_shouldReturnListOfResource.
@Test
public void getPractitionerHistoryById_shouldReturnListOfResource() {
IdType id = new IdType();
id.setValue(PRACTITIONER_UUID);
when(practitionerService.get(PRACTITIONER_UUID)).thenReturn(practitioner);
List<Resource> resources = resourceProvider.getPractitionerHistoryById(id);
assertThat(resources, Matchers.notNullValue());
assertThat(resources, not(empty()));
assertThat(resources.size(), Matchers.equalTo(2));
}
use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.
the class PractitionerFhirResourceProviderTest method findPractitionersByGivenName_shouldReturnMatchingBundleOfPractitioners.
@Test
public void findPractitionersByGivenName_shouldReturnMatchingBundleOfPractitioners() {
StringAndListParam givenName = new StringAndListParam().addAnd(new StringParam(PRACTITIONER_GIVEN_NAME));
when(practitionerService.searchForPractitioners(isNull(), isNull(), argThat(is(givenName)), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull())).thenReturn(new MockIBundleProvider<>(Collections.singletonList(practitioner), PREFERRED_PAGE_SIZE, COUNT));
IBundleProvider results = resourceProvider.searchForPractitioners(null, null, givenName, null, null, null, null, null, null, null, null);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList.iterator().next().fhirType(), is(FhirConstants.PRACTITIONER));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
}
use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.
the class PractitionerFhirResourceProviderTest method getPractitionerHistoryById_shouldReturnProvenanceResources.
@Test
public void getPractitionerHistoryById_shouldReturnProvenanceResources() {
IdType id = new IdType();
id.setValue(PRACTITIONER_UUID);
when(practitionerService.get(PRACTITIONER_UUID)).thenReturn(practitioner);
List<Resource> resources = resourceProvider.getPractitionerHistoryById(id);
assertThat(resources, not(empty()));
assertThat(resources.stream().findAny().isPresent(), Matchers.is(true));
assertThat(resources.stream().findAny().get().getResourceType().name(), Matchers.equalTo(Provenance.class.getSimpleName()));
}
Aggregations