use of org.hl7.fhir.r4b.model.IdType in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceFhirResourceProviderTest method deleteAllergyIntolerance_shouldDeleteRequestedAllergyIntolerance.
@Test
public void deleteAllergyIntolerance_shouldDeleteRequestedAllergyIntolerance() {
when(service.delete(ALLERGY_UUID)).thenReturn(allergyIntolerance);
OperationOutcome result = resourceProvider.deleteAllergy(new IdType().setValue(ALLERGY_UUID));
assertThat(result, notNullValue());
assertThat(result.getIssue(), notNullValue());
assertThat(result.getIssueFirstRep().getSeverity(), equalTo(OperationOutcome.IssueSeverity.INFORMATION));
assertThat(result.getIssueFirstRep().getDetails().getCodingFirstRep().getCode(), equalTo("MSG_DELETED"));
}
use of org.hl7.fhir.r4b.model.IdType in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceFhirResourceProviderTest method getAllergyIntoleranceHistoryByWithWrongId_shouldThrowResourceNotFoundException.
@Test(expected = ResourceNotFoundException.class)
public void getAllergyIntoleranceHistoryByWithWrongId_shouldThrowResourceNotFoundException() {
IdType idType = new IdType();
idType.setValue(WRONG_ALLERGY_UUID);
assertThat(resourceProvider.getAllergyIntoleranceHistoryById(idType).isEmpty(), is(true));
assertThat(resourceProvider.getAllergyIntoleranceHistoryById(idType).size(), equalTo(0));
}
use of org.hl7.fhir.r4b.model.IdType in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceFhirResourceProviderTest method updateAllergyIntolerance_shouldThrowInvalidRequestForMissingId.
@Test(expected = InvalidRequestException.class)
public void updateAllergyIntolerance_shouldThrowInvalidRequestForMissingId() {
AllergyIntolerance noIdAllergyIntolerance = new AllergyIntolerance();
when(service.update(ALLERGY_UUID, noIdAllergyIntolerance)).thenThrow(InvalidRequestException.class);
resourceProvider.updateAllergy(new IdType().setValue(ALLERGY_UUID), noIdAllergyIntolerance);
}
use of org.hl7.fhir.r4b.model.IdType in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceFhirResourceProviderTest method getAllergyIntoleranceByUuid_shouldThrowResourceNotFoundException.
@Test(expected = ResourceNotFoundException.class)
public void getAllergyIntoleranceByUuid_shouldThrowResourceNotFoundException() {
IdType id = new IdType();
id.setValue(WRONG_ALLERGY_UUID);
AllergyIntolerance result = resourceProvider.getAllergyIntoleranceByUuid(id);
assertThat(result, nullValue());
}
use of org.hl7.fhir.r4b.model.IdType in project openmrs-module-fhir2 by openmrs.
the class ConditionFhirResourceProviderTest method updateCondition_shouldUpdateRequestedCondition.
@Test
public void updateCondition_shouldUpdateRequestedCondition() {
when(conditionService.update(CONDITION_UUID, condition)).thenReturn(condition);
MethodOutcome result = resourceProvider.updateCondition(new IdType().setValue(CONDITION_UUID), condition);
assertThat(result, notNullValue());
assertThat(result.getResource(), equalTo(condition));
}
Aggregations