use of org.hl7.fhir.r5.utils.validation.constants in project openmrs-module-fhir2 by openmrs.
the class GroupFhirResourceProviderTest method shouldCreateNewGroup.
@Test
public void shouldCreateNewGroup() {
when(fhirGroupService.create(any(org.hl7.fhir.r4.model.Group.class))).thenReturn(group);
MethodOutcome result = resourceProvider.createGroup(Group30_40.convertGroup(group));
assertThat(result, notNullValue());
assertThat(result.getCreated(), is(true));
assertThat(result.getResource(), notNullValue());
assertThat(result.getResource().getIdElement().getIdPart(), equalTo(group.getId()));
assertThat(result.getResource().getStructureFhirVersionEnum(), equalTo(FhirVersionEnum.DSTU3));
}
use of org.hl7.fhir.r5.utils.validation.constants 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.r5.utils.validation.constants 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);
}
use of org.hl7.fhir.r5.utils.validation.constants in project openmrs-module-fhir2 by openmrs.
the class LocationFhirResourceProviderTest method initLocation.
@Before
public void initLocation() {
Address address = new Address();
address.setCity(CITY);
address.setCountry(COUNTRY);
address.setState(STATE);
address.setPostalCode(POSTAL_CODE);
location = new org.hl7.fhir.r4.model.Location();
location.setId(LOCATION_UUID);
location.setName(LOCATION_NAME);
location.setAddress(address);
location.getMeta().addTag(new Coding(FhirConstants.OPENMRS_FHIR_EXT_LOCATION_TAG, LOGIN_LOCATION_TAG_NAME, LOGIN_LOCATION_TAG_DESCRIPTION));
setProvenanceResources(location);
}
use of org.hl7.fhir.r5.utils.validation.constants in project openmrs-module-fhir2 by openmrs.
the class LocationFhirResourceProviderTest method getLocationByUuid_shouldReturnMatchingLocation.
@Test
public void getLocationByUuid_shouldReturnMatchingLocation() {
when(locationService.get(LOCATION_UUID)).thenReturn(location);
IdType id = new IdType();
id.setValue(LOCATION_UUID);
org.hl7.fhir.dstu3.model.Location result = resourceProvider.getLocationById(id);
assertThat(result, notNullValue());
assertThat(result.getId(), notNullValue());
assertThat(result.getId(), equalTo(LOCATION_UUID));
}
Aggregations