diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/utils/FhirPathEngineR4Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/utils/FhirPathEngineR4Test.java index 20e3a1a37db..acde719ed9a 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/utils/FhirPathEngineR4Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/utils/FhirPathEngineR4Test.java @@ -143,6 +143,19 @@ public class FhirPathEngineR4Test { assertEquals(true, ((BooleanType)result.get(0)).booleanValue()); } + @Test + public void testQuestionnaireResponseExpression() { + + QuestionnaireResponse qr = new QuestionnaireResponse(); + QuestionnaireResponse.QuestionnaireResponseItemComponent parent = qr.addItem().setLinkId("PARENT"); + QuestionnaireResponse.QuestionnaireResponseItemComponent child = parent.addItem().setLinkId("CHILD"); + child.addAnswer().setValue(new DateTimeType("2019-01-01")); + + List answer = ourEngine.evaluate(qr, "QuestionnaireResponse.item.where(linkId = 'PARENT').item.where(linkId = 'CHILD').answer.value.as(DateTime)"); + assertEquals("2019-01-01", ((DateTimeType)answer.get(0)).getValueAsString()); + + } + @AfterClass public static void afterClassClearContext() throws Exception {