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))));
}
Aggregations