use of org.hl7.fhir.dstu2.model.IdType in project openmrs-module-fhir2 by openmrs.
the class ImmunizationFhirResourceProviderTest method updateImmunization_shouldUpdateRequestedImmunization.
@Test
public void updateImmunization_shouldUpdateRequestedImmunization() {
when(immunizationService.update(IMMUNIZATION_UUID, immunization)).thenReturn(immunization);
MethodOutcome result = resourceProvider.updateImmunization(new IdType().setValue(IMMUNIZATION_UUID), immunization);
assertThat(result, notNullValue());
assertThat(result.getResource(), equalTo(immunization));
}
use of org.hl7.fhir.dstu2.model.IdType in project openmrs-module-fhir2 by openmrs.
the class ImmunizationFhirResourceProviderTest method getImmunizationHistory_shouldReturnListOfResource.
@Test
public void getImmunizationHistory_shouldReturnListOfResource() {
IdType id = new IdType();
id.setValue(IMMUNIZATION_UUID);
when(immunizationService.get(IMMUNIZATION_UUID)).thenReturn(immunization);
List<Resource> resources = resourceProvider.getImmunizationHistoryById(id);
assertThat(resources, notNullValue());
assertThat(resources, not(empty()));
assertThat(resources.size(), equalTo(2));
}
use of org.hl7.fhir.dstu2.model.IdType in project openmrs-module-fhir2 by openmrs.
the class ImmunizationFhirResourceProviderTest method getImmunizationHistoryByWithWrongId_shouldThrowResourceNotFoundException.
@Test(expected = ResourceNotFoundException.class)
public void getImmunizationHistoryByWithWrongId_shouldThrowResourceNotFoundException() {
IdType idType = new IdType();
idType.setValue(WRONG_IMMUNIZATION_UUID);
assertThat(resourceProvider.getImmunizationHistoryById(idType).isEmpty(), is(true));
assertThat(resourceProvider.getImmunizationHistoryById(idType).size(), equalTo(0));
}
use of org.hl7.fhir.dstu2.model.IdType in project openmrs-module-fhir2 by openmrs.
the class LocationFhirResourceProviderTest method updateLocation_shouldThrowInvalidRequestExceptionForMissingId.
@Test(expected = InvalidRequestException.class)
public void updateLocation_shouldThrowInvalidRequestExceptionForMissingId() {
Location noIdLocation = new Location();
when(locationService.update(LOCATION_UUID, noIdLocation)).thenThrow(InvalidRequestException.class);
resourceProvider.updateLocation(new IdType().setValue(LOCATION_UUID), noIdLocation);
}
use of org.hl7.fhir.dstu2.model.IdType in project openmrs-module-fhir2 by openmrs.
the class LocationFhirResourceProviderTest method getLocationHistoryById_shouldReturnProvenanceResources.
@Test
public void getLocationHistoryById_shouldReturnProvenanceResources() {
IdType id = new IdType();
id.setValue(LOCATION_UUID);
when(locationService.get(LOCATION_UUID)).thenReturn(location);
List<Resource> resources = resourceProvider.getLocationHistoryById(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