use of org.hl7.fhir.r5.utils.validation.constants in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceFhirR3ResourceProviderTest method createAllergyIntolerance_shouldCreateNewAllergyIntolerance.
@Test
public void createAllergyIntolerance_shouldCreateNewAllergyIntolerance() {
when(service.create(any(org.hl7.fhir.r4.model.AllergyIntolerance.class))).thenReturn(allergyIntolerance);
MethodOutcome result = resourceProvider.creatAllergyIntolerance(AllergyIntolerance30_40.convertAllergyIntolerance(allergyIntolerance));
assertThat(result, notNullValue());
assertThat(result.getCreated(), is(true));
assertThat(result.getResource(), notNullValue());
assertThat(result.getResource().getIdElement().getIdPart(), equalTo(ALLERGY_UUID));
}
use of org.hl7.fhir.r5.utils.validation.constants in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceFhirR3ResourceProviderTest method searchForAllergies_shouldAddPatientsToReturnedResultsForPatientInclude.
@Test
public void searchForAllergies_shouldAddPatientsToReturnedResultsForPatientInclude() {
HashSet<Include> includes = new HashSet<>();
includes.add(new Include("AllergyIntolerance:patient"));
when(service.searchForAllergies(isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), argThat(is(includes)))).thenReturn(new MockIBundleProvider<>(Arrays.asList(allergyIntolerance, new org.hl7.fhir.r4.model.Patient()), PREFERRED_PAGE_SIZE, COUNT));
IBundleProvider results = resourceProvider.searchForAllergies(null, null, null, null, null, null, null, null, null, null, includes);
List<IBaseResource> resultList = results.getResources(START_INDEX, END_INDEX);
assertThat(results, notNullValue());
assertThat(resultList.size(), greaterThanOrEqualTo(2));
assertThat(resultList.get(0).fhirType(), is(FhirConstants.ALLERGY_INTOLERANCE));
assertThat(resultList.get(1).fhirType(), is(FhirConstants.PATIENT));
assertThat(((AllergyIntolerance) resultList.iterator().next()).getId(), equalTo(ALLERGY_UUID));
}
use of org.hl7.fhir.r5.utils.validation.constants in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceFhirR3ResourceProviderTest method updateAllergyIntolerance_shouldUpdateAllergyIntolerance.
@Test
public void updateAllergyIntolerance_shouldUpdateAllergyIntolerance() {
when(service.update(eq(ALLERGY_UUID), any(org.hl7.fhir.r4.model.AllergyIntolerance.class))).thenReturn(allergyIntolerance);
MethodOutcome result = resourceProvider.updateAllergyIntolerance(new IdType().setValue(ALLERGY_UUID), AllergyIntolerance30_40.convertAllergyIntolerance(allergyIntolerance));
assertThat(result, notNullValue());
assertThat(result.getResource(), notNullValue());
assertThat(result.getResource().getIdElement().getIdPart(), equalTo(ALLERGY_UUID));
}
use of org.hl7.fhir.r5.utils.validation.constants in project openmrs-module-fhir2 by openmrs.
the class ConditionFhirR3ResourceProviderTest method createCondition_shouldCreateNewCondition.
@Test
public void createCondition_shouldCreateNewCondition() {
when(conditionService.create(any(org.hl7.fhir.r4.model.Condition.class))).thenReturn(condition);
MethodOutcome result = resourceProvider.createCondition(Condition30_40.convertCondition(condition));
assertThat(result, notNullValue());
assertThat(result.getCreated(), is(true));
assertThat(result.getResource(), notNullValue());
assertThat(result.getResource().getIdElement().getIdPart(), equalTo(CONDITION_UUID));
}
use of org.hl7.fhir.r5.utils.validation.constants in project openmrs-module-fhir2 by openmrs.
the class DiagnosticReportFhirResourceProviderTest method createDiagnosticReport_shouldCreateNewDiagnosticReport.
@Test
public void createDiagnosticReport_shouldCreateNewDiagnosticReport() {
when(service.create(any(org.hl7.fhir.r4.model.DiagnosticReport.class))).thenReturn(diagnosticReport);
MethodOutcome result = resourceProvider.createDiagnosticReport(DiagnosticReport30_40.convertDiagnosticReport(diagnosticReport));
assertThat(result, notNullValue());
assertThat(result.getResource(), notNullValue());
assertThat(result.getResource().getIdElement().getIdPart(), equalTo(diagnosticReport.getId()));
}
Aggregations