use of org.hl7.fhir.r4b.model.IdType in project openmrs-module-fhir2 by openmrs.
the class DiagnosticReportFhirResourceProviderTest method updateDiagnosticReport_shouldThrowInvalidRequestForMissingId.
@Test(expected = InvalidRequestException.class)
public void updateDiagnosticReport_shouldThrowInvalidRequestForMissingId() {
DiagnosticReport noIdDiagnosticReport = new DiagnosticReport();
when(service.update(eq(UUID), any(org.hl7.fhir.r4.model.DiagnosticReport.class))).thenThrow(InvalidRequestException.class);
resourceProvider.updateDiagnosticReport(new IdType().setValue(UUID), noIdDiagnosticReport);
}
use of org.hl7.fhir.r4b.model.IdType in project openmrs-module-fhir2 by openmrs.
the class EncounterFhirResourceProviderTest method updateEncounter_shouldUpdateEncounter.
@Test
public void updateEncounter_shouldUpdateEncounter() {
when(encounterService.update(eq(ENCOUNTER_UUID), any(org.hl7.fhir.r4.model.Encounter.class))).thenReturn(encounter);
MethodOutcome result = resourceProvider.updateEncounter(new IdType().setValue(ENCOUNTER_UUID), Encounter30_40.convertEncounter(encounter));
assertThat(result, notNullValue());
assertThat(result.getResource(), notNullValue());
assertThat(result.getResource().getIdElement().getIdPart(), equalTo(ENCOUNTER_UUID));
}
use of org.hl7.fhir.r4b.model.IdType in project openmrs-module-fhir2 by openmrs.
the class EncounterFhirResourceProviderTest method deleteEncounter_shouldDeleteRequestedEncounter.
@Test
public void deleteEncounter_shouldDeleteRequestedEncounter() {
when(encounterService.delete(ENCOUNTER_UUID)).thenReturn(encounter);
OperationOutcome result = resourceProvider.deleteEncounter(new IdType().setValue(ENCOUNTER_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.r4b.model.IdType in project openmrs-module-fhir2 by openmrs.
the class EncounterFhirResourceProviderTest method getEncounterWithWrongUuid_shouldThrowResourceNotFoundException.
@Test(expected = ResourceNotFoundException.class)
public void getEncounterWithWrongUuid_shouldThrowResourceNotFoundException() {
IdType id = new IdType();
id.setValue(WRONG_ENCOUNTER_UUID);
resourceProvider.getEncounterById(id);
}
use of org.hl7.fhir.r4b.model.IdType in project openmrs-module-fhir2 by openmrs.
the class EncounterFhirResourceProviderTest method getEncounterByUuid_shouldReturnMatchingEncounter.
@Test
public void getEncounterByUuid_shouldReturnMatchingEncounter() {
IdType id = new IdType();
id.setValue(ENCOUNTER_UUID);
when(encounterService.get(ENCOUNTER_UUID)).thenReturn(encounter);
Encounter result = resourceProvider.getEncounterById(id);
assertThat(result, notNullValue());
assertThat(result.getId(), notNullValue());
assertThat(result.getId(), equalTo(ENCOUNTER_UUID));
assertThat(result.getStatus(), equalTo(Encounter.EncounterStatus.UNKNOWN));
}
Aggregations