Search in sources :

Example 66 with FhirTask

use of org.openmrs.module.fhir2.model.FhirTask in project openmrs-module-fhir2 by openmrs.

the class FhirTaskTranslatorImplTest method toOpenmrsType_shouldTranslateInputTextValue.

@Test
public void toOpenmrsType_shouldTranslateInputTextValue() {
    Task task = new Task();
    Task.ParameterComponent input = new Task.ParameterComponent();
    CodeableConcept inputType = new CodeableConcept().setText("some text");
    String inputVal = "some input value";
    input.setType(inputType).setValue(new StringType(inputVal));
    Concept openmrsInputType = new Concept();
    openmrsInputType.setUuid(CONCEPT_UUID);
    task.setInput(Collections.singletonList(input));
    when(conceptTranslator.toOpenmrsType(inputType)).thenReturn(openmrsInputType);
    FhirTask result = taskTranslator.toOpenmrsType(task);
    assertThat(result.getInput(), not(empty()));
    assertThat(result.getInput(), hasItem(hasProperty("type", hasProperty("uuid", equalTo(CONCEPT_UUID)))));
    assertThat(result.getInput(), hasItem(hasProperty("valueText", equalTo(inputVal))));
}
Also used : CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Concept(org.openmrs.Concept) Task(org.hl7.fhir.r4.model.Task) FhirTask(org.openmrs.module.fhir2.model.FhirTask) StringType(org.hl7.fhir.r4.model.StringType) FhirTask(org.openmrs.module.fhir2.model.FhirTask) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Test(org.junit.Test)

Aggregations

FhirTask (org.openmrs.module.fhir2.model.FhirTask)66 Test (org.junit.Test)57 Task (org.hl7.fhir.r4.model.Task)47 FhirReference (org.openmrs.module.fhir2.model.FhirReference)16 BaseModuleContextSensitiveTest (org.openmrs.test.BaseModuleContextSensitiveTest)10 Reference (org.hl7.fhir.r4.model.Reference)9 Concept (org.openmrs.Concept)9 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)7 Date (java.util.Date)5 FhirTaskInput (org.openmrs.module.fhir2.model.FhirTaskInput)4 FhirTaskOutput (org.openmrs.module.fhir2.model.FhirTaskOutput)4 Coding (org.hl7.fhir.r4.model.Coding)3 StringType (org.hl7.fhir.r4.model.StringType)3 ArrayList (java.util.ArrayList)2 Identifier (org.hl7.fhir.r4.model.Identifier)2 Provenance (org.hl7.fhir.r4.model.Provenance)2 Before (org.junit.Before)2 HibernateConceptDAO (org.openmrs.api.db.hibernate.HibernateConceptDAO)2 IBundleProvider (ca.uhn.fhir.rest.api.server.IBundleProvider)1 Collection (java.util.Collection)1