use of org.hl7.fhir.r4b.model.IdType in project openmrs-module-fhir2 by openmrs.
the class ConditionFhirR3ResourceProviderTest method getConditionHistoryByWithWrongId_shouldThrowResourceNotFoundException.
@Test(expected = ResourceNotFoundException.class)
public void getConditionHistoryByWithWrongId_shouldThrowResourceNotFoundException() {
IdType idType = new IdType();
idType.setValue(WRONG_CONDITION_UUID);
assertThat(resourceProvider.getConditionHistoryById(idType).isEmpty(), is(true));
assertThat(resourceProvider.getConditionHistoryById(idType).size(), Matchers.equalTo(0));
}
use of org.hl7.fhir.r4b.model.IdType in project openmrs-module-fhir2 by openmrs.
the class ConditionFhirR3ResourceProviderTest method deleteCondition_shouldThrowResourceNotFoundExceptionWhenConditionNotFound.
@Test
public void deleteCondition_shouldThrowResourceNotFoundExceptionWhenConditionNotFound() {
when(conditionService.delete(WRONG_CONDITION_UUID)).thenReturn(null);
assertThrows(ResourceNotFoundException.class, () -> resourceProvider.deleteCondition(new IdType().setValue(WRONG_CONDITION_UUID)));
}
use of org.hl7.fhir.r4b.model.IdType in project openmrs-module-fhir2 by openmrs.
the class ConditionFhirR3ResourceProviderTest method getConditionHistory_shouldReturnProvenanceResources.
@Test
public void getConditionHistory_shouldReturnProvenanceResources() {
IdType id = new IdType();
id.setValue(CONDITION_UUID);
when(conditionService.get(CONDITION_UUID)).thenReturn(condition);
List<Resource> resources = resourceProvider.getConditionHistoryById(id);
assertThat(resources, not(empty()));
assertThat(resources.stream().findAny().isPresent(), is(true));
assertThat(resources.stream().findAny().get().getResourceType().name(), Matchers.equalTo(Provenance.class.getSimpleName()));
}
use of org.hl7.fhir.r4b.model.IdType in project openmrs-module-fhir2 by openmrs.
the class DiagnosticReportFhirResourceProviderTest method getDiagnosticReportById_shouldReturnMatchingDiagnosticReport.
@Test
public void getDiagnosticReportById_shouldReturnMatchingDiagnosticReport() {
IdType id = new IdType();
id.setValue(UUID);
when(service.get(UUID)).thenReturn(diagnosticReport);
DiagnosticReport result = resourceProvider.getDiagnosticReportById(id);
assertThat(result, notNullValue());
assertThat(result.isResource(), is(true));
assertThat(result.getId(), equalTo(UUID));
}
use of org.hl7.fhir.r4b.model.IdType in project openmrs-module-fhir2 by openmrs.
the class DiagnosticReportFhirResourceProviderTest method updateDiagnosticReport_shouldThrowMethodNotAllowedIfDoesNotExist.
@Test(expected = MethodNotAllowedException.class)
public void updateDiagnosticReport_shouldThrowMethodNotAllowedIfDoesNotExist() {
DiagnosticReport wrongDiagnosticReport = new DiagnosticReport();
wrongDiagnosticReport.setId(WRONG_UUID);
when(service.update(eq(WRONG_UUID), any(org.hl7.fhir.r4.model.DiagnosticReport.class))).thenThrow(MethodNotAllowedException.class);
resourceProvider.updateDiagnosticReport(new IdType().setValue(WRONG_UUID), wrongDiagnosticReport);
}
Aggregations