use of com.ibm.watson.compare_comply.v1.model.Location in project openmrs-module-fhir2 by openmrs.
the class LocationFhirResourceProviderWebTest method getLocationById_shouldReturnLocationWithMatchingUuid.
@Test
public void getLocationById_shouldReturnLocationWithMatchingUuid() throws Exception {
org.hl7.fhir.r4.model.Location location = new org.hl7.fhir.r4.model.Location();
location.setId(LOCATION_UUID);
when(locationService.get(LOCATION_UUID)).thenReturn(location);
MockHttpServletResponse response = get("/Location/" + LOCATION_UUID).accept(FhirMediaTypes.JSON).go();
assertThat(response, isOk());
assertThat(response.getContentType(), equalTo(FhirMediaTypes.JSON.toString()));
Location resource = readResponse(response);
assertThat(resource.getIdElement().getIdPart(), equalTo(LOCATION_UUID));
}
use of com.ibm.watson.compare_comply.v1.model.Location in project openmrs-module-fhir2 by openmrs.
the class LocationFhirResourceProviderWebTest method deleteLocation_shouldDeleteLocation.
@Test
public void deleteLocation_shouldDeleteLocation() throws Exception {
org.hl7.fhir.r4.model.Location location = new org.hl7.fhir.r4.model.Location();
location.setId(LOCATION_UUID);
when(locationService.delete(LOCATION_UUID)).thenReturn(location);
MockHttpServletResponse response = delete("/Location/" + LOCATION_UUID).accept(FhirMediaTypes.JSON).go();
assertThat(response, isOk());
assertThat(response.getContentType(), equalTo(FhirMediaTypes.JSON.toString()));
}
use of com.ibm.watson.compare_comply.v1.model.Location in project openmrs-module-fhir2 by openmrs.
the class LocationFhirResourceProviderWebTest method verifyURI.
private void verifyURI(String uri) throws Exception {
Location location = new Location();
location.setId(LOCATION_UUID);
when(locationService.searchForLocations(any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), any())).thenReturn(new MockIBundleProvider<>(Collections.singletonList(location), 10, 1));
MockHttpServletResponse response = get(uri).accept(FhirMediaTypes.JSON).go();
assertThat(response, isOk());
assertThat(response.getContentType(), equalTo(FhirMediaTypes.JSON.toString()));
assertThat(readBundleResponse(response).getEntry().size(), greaterThanOrEqualTo(1));
}
use of com.ibm.watson.compare_comply.v1.model.Location in project openmrs-module-fhir2 by openmrs.
the class LocationFhirResourceProviderWebTest method getLocationById_shouldReturnLocationWithMatchingUuid.
@Test
public void getLocationById_shouldReturnLocationWithMatchingUuid() throws Exception {
Location location = new Location();
location.setId(LOCATION_UUID);
when(locationService.get(LOCATION_UUID)).thenReturn(location);
MockHttpServletResponse response = get("/Location/" + LOCATION_UUID).accept(FhirMediaTypes.JSON).go();
assertThat(response, isOk());
assertThat(response.getContentType(), equalTo(FhirMediaTypes.JSON.toString()));
Location resource = readResponse(response);
assertThat(resource.getIdElement().getIdPart(), equalTo(LOCATION_UUID));
}
use of com.ibm.watson.compare_comply.v1.model.Location in project openmrs-module-fhir2 by openmrs.
the class LocationFhirResourceProviderWebTest method createLocation_shouldCreateLocation.
@Test
public void createLocation_shouldCreateLocation() throws Exception {
String jsonLocation;
try (InputStream is = this.getClass().getClassLoader().getResourceAsStream(JSON_CREATE_LOCATION_PATH)) {
Objects.requireNonNull(is);
jsonLocation = IOUtils.toString(is, StandardCharsets.UTF_8);
}
Location location = new Location();
location.setId(LOCATION_UUID);
when(locationService.create(any(Location.class))).thenReturn(location);
MockHttpServletResponse response = post("/Location").jsonContent(jsonLocation).accept(FhirMediaTypes.JSON).go();
assertThat(response, isCreated());
}
Aggregations