use of org.hl7.fhir.dstu2.model.IdType in project openmrs-module-fhir2 by openmrs.
the class EncounterFhirResourceProviderTest method getEncounterHistoryByWithWrongId_shouldThrowResourceNotFoundException.
@Test(expected = ResourceNotFoundException.class)
public void getEncounterHistoryByWithWrongId_shouldThrowResourceNotFoundException() {
IdType idType = new IdType();
idType.setValue(WRONG_ENCOUNTER_UUID);
assertThat(resourceProvider.getEncounterHistoryById(idType).isEmpty(), is(true));
assertThat(resourceProvider.getEncounterHistoryById(idType).size(), Matchers.equalTo(0));
}
use of org.hl7.fhir.dstu2.model.IdType in project openmrs-module-fhir2 by openmrs.
the class GroupFhirResourceProviderTest method shouldDeleteRequestedGroup.
@Test
public void shouldDeleteRequestedGroup() {
when(fhirGroupService.delete(COHORT_UUID)).thenReturn(group);
OperationOutcome result = resourceProvider.deleteGroup(new IdType().setValue(COHORT_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.dstu2.model.IdType in project openmrs-module-fhir2 by openmrs.
the class GroupFhirResourceProviderTest method shouldUpdateExistingGroup.
@Test
public void shouldUpdateExistingGroup() {
org.hl7.fhir.r4.model.Group.GroupMemberComponent groupMemberComponent = mock(org.hl7.fhir.r4.model.Group.GroupMemberComponent.class);
group.setActual(false);
group.addMember(groupMemberComponent);
when(fhirGroupService.update(eq(COHORT_UUID), any(org.hl7.fhir.r4.model.Group.class))).thenReturn(group);
MethodOutcome result = resourceProvider.updateGroup(new IdType().setValue(COHORT_UUID), Group30_40.convertGroup(group));
assertThat(result, notNullValue());
assertThat(result.getResource(), notNullValue());
assertThat(result.getResource().getIdElement().getIdPart(), equalTo(group.getId()));
assertThat(result.getResource().getStructureFhirVersionEnum(), equalTo(FhirVersionEnum.DSTU3));
}
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(), is(true));
assertThat(resources.stream().findAny().get().getResourceType().name(), equalTo(Provenance.class.getSimpleName()));
}
use of org.hl7.fhir.dstu2.model.IdType in project openmrs-module-fhir2 by openmrs.
the class LocationFhirResourceProviderTest method updateLocation_shouldThrowInvalidRequestForMissingId.
@Test(expected = InvalidRequestException.class)
public void updateLocation_shouldThrowInvalidRequestForMissingId() {
Location noIdLocation = new Location();
when(locationService.update(eq(LOCATION_UUID), any(org.hl7.fhir.r4.model.Location.class))).thenThrow(InvalidRequestException.class);
resourceProvider.updateLocation(new IdType().setValue(LOCATION_UUID), noIdLocation);
}
Aggregations