use of org.hl7.fhir.dstu3.model.DiagnosticReport in project openmrs-module-fhir2 by openmrs.
the class FhirDiagnosticReportServiceImplTest method updateTask_shouldThrowResourceNotFoundIfTaskDoesNotExist.
@Test(expected = ResourceNotFoundException.class)
public void updateTask_shouldThrowResourceNotFoundIfTaskDoesNotExist() {
DiagnosticReport diagnosticReport = new DiagnosticReport();
diagnosticReport.setId(WRONG_UUID);
when(dao.get(WRONG_UUID)).thenReturn(null);
service.update(WRONG_UUID, diagnosticReport);
}
use of org.hl7.fhir.dstu3.model.DiagnosticReport in project openmrs-module-fhir2 by openmrs.
the class FhirDiagnosticReportServiceImplTest method searchForDiagnosticReports_shouldReturnCollectionOfDiagnosticReportsByParameters.
@Test
public void searchForDiagnosticReports_shouldReturnCollectionOfDiagnosticReportsByParameters() {
FhirDiagnosticReport fhirDiagnosticReport = new FhirDiagnosticReport();
fhirDiagnosticReport.setUuid(UUID);
DiagnosticReport diagnosticReport = new DiagnosticReport();
diagnosticReport.setId(UUID);
List<FhirDiagnosticReport> fhirDiagnosticReports = new ArrayList<>();
fhirDiagnosticReports.add(fhirDiagnosticReport);
SearchParameterMap theParams = new SearchParameterMap();
when(dao.getSearchResults(any(), any())).thenReturn(fhirDiagnosticReports);
when(dao.getSearchResultUuids(any())).thenReturn(Collections.singletonList(UUID));
when(translator.toFhirResource(fhirDiagnosticReport)).thenReturn(diagnosticReport);
when(searchQuery.getQueryResults(any(), any(), any(), any())).thenReturn(new SearchQueryBundleProvider<>(theParams, dao, translator, globalPropertyService, searchQueryInclude));
when(searchQueryInclude.getIncludedResources(any(), any())).thenReturn(Collections.emptySet());
IBundleProvider results = service.searchForDiagnosticReports(null, null, null, null, null, null, null, null, null);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList, not(empty()));
assertThat(resultList, hasItem(hasProperty("id", equalTo(UUID))));
}
use of org.hl7.fhir.dstu3.model.DiagnosticReport in project openmrs-module-fhir2 by openmrs.
the class DiagnosticReportTranslatorImplTest method toFhirResource_shouldTranslateOpenMrsDateChangedToLastUpdatedDate.
@Test
public void toFhirResource_shouldTranslateOpenMrsDateChangedToLastUpdatedDate() {
fhirDiagnosticReport.setDateChanged(new Date());
DiagnosticReport result = translator.toFhirResource(fhirDiagnosticReport);
assertThat(result, notNullValue());
assertThat(result.getMeta().getLastUpdated(), DateMatchers.sameDay(new Date()));
}
use of org.hl7.fhir.dstu3.model.DiagnosticReport in project openmrs-module-fhir2 by openmrs.
the class DiagnosticReportTranslatorImplTest method toFhirResource_shouldSetUnknownStatus.
@Test
public void toFhirResource_shouldSetUnknownStatus() {
DiagnosticReport result = translator.toFhirResource(fhirDiagnosticReport);
assertThat(result.getStatus(), equalTo(DiagnosticReport.DiagnosticReportStatus.UNKNOWN));
}
use of org.hl7.fhir.dstu3.model.DiagnosticReport in project openmrs-module-fhir2 by openmrs.
the class DiagnosticReportTranslatorImplTest method toFhirResource_shouldConvertEncounter.
@Test
public void toFhirResource_shouldConvertEncounter() {
Encounter encounter = new Encounter();
Reference encounterReference = new Reference();
fhirDiagnosticReport.setEncounter(encounter);
when(encounterReferenceTranslator.toFhirResource(encounter)).thenReturn(encounterReference);
DiagnosticReport result = translator.toFhirResource(fhirDiagnosticReport);
assertThat(result.getEncounter(), equalTo(encounterReference));
}
Aggregations