use of org.hl7.fhir.r4.model.AllergyIntolerance in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceFhirR3ResourceProviderTest method searchForAllergies_shouldReturnMatchingBundleOfAllergiesByPatientGivenName.
@Test
public void searchForAllergies_shouldReturnMatchingBundleOfAllergiesByPatientGivenName() {
ReferenceAndListParam patient = new ReferenceAndListParam();
patient.addValue(new ReferenceOrListParam().add(new ReferenceParam().setValue("John").setChain(Patient.SP_GIVEN)));
when(service.searchForAllergies(argThat(is(patient)), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull())).thenReturn(new MockIBundleProvider<>(Collections.singletonList(allergyIntolerance), PREFERRED_PAGE_SIZE, COUNT));
IBundleProvider results = resourceProvider.searchForAllergies(patient, null, null, null, null, null, null, null, null, null, null);
List<AllergyIntolerance> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList.get(0).fhirType(), is(FhirConstants.ALLERGY_INTOLERANCE));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
assertThat(resultList.get(0).getId(), equalTo(ALLERGY_UUID));
}
use of org.hl7.fhir.r4.model.AllergyIntolerance in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceFhirR3ResourceProviderTest method getAllergyIntoleranceByUuid_shouldReturnMatchingAllergy.
@Test
public void getAllergyIntoleranceByUuid_shouldReturnMatchingAllergy() {
when(service.get(ALLERGY_UUID)).thenReturn(allergyIntolerance);
IdType id = new IdType();
id.setValue(ALLERGY_UUID);
AllergyIntolerance allergy = resourceProvider.getAllergyIntoleranceById(id);
assertThat(allergy, notNullValue());
assertThat(allergy.getId(), notNullValue());
assertThat(allergy.getId(), equalTo(ALLERGY_UUID));
}
use of org.hl7.fhir.r4.model.AllergyIntolerance in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceFhirR3ResourceProviderTest method searchForAllergies_shouldReturnMatchingBundleOfAllergiesByPatientFamilyName.
@Test
public void searchForAllergies_shouldReturnMatchingBundleOfAllergiesByPatientFamilyName() {
ReferenceAndListParam patient = new ReferenceAndListParam();
patient.addValue(new ReferenceOrListParam().add(new ReferenceParam().setValue("John").setChain(Patient.SP_FAMILY)));
when(service.searchForAllergies(argThat(is(patient)), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull())).thenReturn(new MockIBundleProvider<>(Collections.singletonList(allergyIntolerance), PREFERRED_PAGE_SIZE, COUNT));
IBundleProvider results = resourceProvider.searchForAllergies(patient, null, null, null, null, null, null, null, null, null, null);
List<AllergyIntolerance> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList.get(0).fhirType(), is(FhirConstants.ALLERGY_INTOLERANCE));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
assertThat(resultList.get(0).getId(), equalTo(ALLERGY_UUID));
}
use of org.hl7.fhir.r4.model.AllergyIntolerance in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceFhirR3ResourceProviderTest method searchForAllergies_shouldReturnMatchingBundleOfAllergiesByStatus.
@Test
public void searchForAllergies_shouldReturnMatchingBundleOfAllergiesByStatus() {
TokenAndListParam status = new TokenAndListParam();
status.addAnd(new TokenOrListParam().addOr(new TokenParam().setValue("active")));
when(service.searchForAllergies(isNull(), isNull(), isNull(), isNull(), isNull(), argThat(is(status)), isNull(), isNull(), isNull(), isNull())).thenReturn(new MockIBundleProvider<>(Collections.singletonList(allergyIntolerance), PREFERRED_PAGE_SIZE, COUNT));
IBundleProvider results = resourceProvider.searchForAllergies(null, null, null, null, null, null, status, null, null, null, null);
List<AllergyIntolerance> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList.get(0).fhirType(), is(FhirConstants.ALLERGY_INTOLERANCE));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
assertThat(resultList.get(0).getId(), equalTo(ALLERGY_UUID));
}
use of org.hl7.fhir.r4.model.AllergyIntolerance in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceFhirR3ResourceProviderTest method searchForAllergies_shouldReturnMatchingBundleOfAllergiesByPatientName.
@Test
public void searchForAllergies_shouldReturnMatchingBundleOfAllergiesByPatientName() {
ReferenceAndListParam patient = new ReferenceAndListParam();
patient.addValue(new ReferenceOrListParam().add(new ReferenceParam().setValue("John Doe").setChain(Patient.SP_NAME)));
when(service.searchForAllergies(argThat(is(patient)), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull())).thenReturn(new MockIBundleProvider<>(Collections.singletonList(allergyIntolerance), PREFERRED_PAGE_SIZE, COUNT));
IBundleProvider results = resourceProvider.searchForAllergies(patient, null, null, null, null, null, null, null, null, null, null);
List<AllergyIntolerance> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList.get(0).fhirType(), is(FhirConstants.ALLERGY_INTOLERANCE));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
assertThat(resultList.get(0).getId(), equalTo(ALLERGY_UUID));
}
Aggregations