use of org.hl7.fhir.r5.model.Task in project openmrs-module-fhir2 by openmrs.
the class TaskFhirResourceProviderTest method getTaskById_shouldReturnMatchingTask.
@Test
public void getTaskById_shouldReturnMatchingTask() {
IdType id = new IdType();
id.setValue(TASK_UUID);
when(taskService.get(TASK_UUID)).thenReturn(task);
Task result = resourceProvider.getTaskById(id);
assertThat(result.isResource(), is(true));
assertThat(result, notNullValue());
assertThat(result.getId(), notNullValue());
assertThat(result.getId(), equalTo(TASK_UUID));
}
use of org.hl7.fhir.r5.model.Task in project openmrs-module-fhir2 by openmrs.
the class TaskFhirResourceProviderTest method updateTask_shouldUpdateTask.
@Test
public void updateTask_shouldUpdateTask() {
when(taskService.update(eq(TASK_UUID), any(org.hl7.fhir.r4.model.Task.class))).thenReturn(task);
MethodOutcome result = resourceProvider.updateTask(new IdType().setValue(TASK_UUID), TaskVersionConverter.convertTask(task));
assertThat(result, notNullValue());
assertThat(result.getResource(), notNullValue());
assertThat(result.getResource().getIdElement().getIdPart(), equalTo(TASK_UUID));
}
use of org.hl7.fhir.r5.model.Task in project openmrs-module-fhir2 by openmrs.
the class ProvenanceTranslatorImplTest method shouldGetCreateProvenanceWithCorrectAgentRoleForOpenmrsMetadata.
@Test
public void shouldGetCreateProvenanceWithCorrectAgentRoleForOpenmrsMetadata() {
Provenance provenance = taskProvenanceTranslator.getCreateProvenance(task);
assertThat(provenance, notNullValue());
assertThat(provenance.getAgent(), not(empty()));
assertThat(provenance.getAgentFirstRep().getRoleFirstRep(), notNullValue());
assertThat(provenance.getAgentFirstRep().getRoleFirstRep().getCodingFirstRep(), notNullValue());
assertThat(provenance.getAgentFirstRep().getRoleFirstRep().getCodingFirstRep().getCode(), equalTo(AGENT_ROLE_CODE));
assertThat(provenance.getAgentFirstRep().getRoleFirstRep().getCodingFirstRep().getDisplay(), equalTo(AGENT_ROLE_DISPLAY));
assertThat(provenance.getAgentFirstRep().getRoleFirstRep().getCodingFirstRep().getSystem(), equalTo(FhirConstants.FHIR_TERMINOLOGY_PARTICIPATION_TYPE));
}
use of org.hl7.fhir.r5.model.Task in project openmrs-module-fhir2 by openmrs.
the class ProvenanceTranslatorImplTest method shouldGetCreateProvenanceWithCorrectDateChangedForOpenmrsMetadata.
@Test
public void shouldGetCreateProvenanceWithCorrectDateChangedForOpenmrsMetadata() {
Provenance provenance = taskProvenanceTranslator.getCreateProvenance(task);
assertThat(provenance, notNullValue());
assertThat(provenance.getRecorded(), notNullValue());
assertThat(provenance.getRecorded(), DateMatchers.sameDay(new Date()));
}
use of org.hl7.fhir.r5.model.Task in project openmrs-module-fhir2 by openmrs.
the class ProvenanceTranslatorImplTest method shouldGetCreateProvenanceWithCorrectAgentTypeForOpenmrsMetadata.
@Test
public void shouldGetCreateProvenanceWithCorrectAgentTypeForOpenmrsMetadata() {
Provenance provenance = taskProvenanceTranslator.getCreateProvenance(task);
assertThat(provenance, notNullValue());
assertThat(provenance.getAgent(), not(empty()));
assertThat(provenance.getAgentFirstRep().getType(), notNullValue());
assertThat(provenance.getAgentFirstRep().getType().getCodingFirstRep(), notNullValue());
assertThat(provenance.getAgentFirstRep().getType().getCodingFirstRep().getCode(), equalTo(AGENT_TYPE_CODE));
assertThat(provenance.getAgentFirstRep().getType().getCodingFirstRep().getDisplay(), equalTo(AGENT_TYPE_DISPLAY));
assertThat(provenance.getAgentFirstRep().getType().getCodingFirstRep().getSystem(), equalTo(FhirConstants.FHIR_TERMINOLOGY_PROVENANCE_PARTICIPANT_TYPE));
}
Aggregations