diff --git a/hapi-fhir-converter/pom.xml b/hapi-fhir-converter/pom.xml index 75475bbddf6..e0c5d0d491d 100644 --- a/hapi-fhir-converter/pom.xml +++ b/hapi-fhir-converter/pom.xml @@ -11,6 +11,7 @@ hapi-fhir-converter bundle + 3.5.1-PHRFIX-SNAPSHOT @@ -84,7 +85,7 @@ ca.uhn.hapi.fhir hapi-fhir-client - ${project.version} + 3.5.0 test diff --git a/hapi-fhir-validation/pom.xml b/hapi-fhir-validation/pom.xml index 3706695e243..7cafb6169e0 100644 --- a/hapi-fhir-validation/pom.xml +++ b/hapi-fhir-validation/pom.xml @@ -11,6 +11,7 @@ hapi-fhir-validation bundle + 3.5.1-PHRFIX-SNAPSHOT HAPI FHIR - Validation @@ -18,17 +19,17 @@ ca.uhn.hapi.fhir hapi-fhir-base - ${project.version} + 3.5.0 ca.uhn.hapi.fhir hapi-fhir-utilities - ${project.version} + 3.5.0 ca.uhn.hapi.fhir hapi-fhir-converter - ${project.version} + 3.5.1-PHRFIX-SNAPSHOT @@ -63,49 +64,49 @@ ca.uhn.hapi.fhir hapi-fhir-structures-dstu2 - ${project.version} + 3.5.0 true ca.uhn.hapi.fhir hapi-fhir-structures-hl7org-dstu2 - ${project.version} + 3.5.0 true ca.uhn.hapi.fhir hapi-fhir-structures-dstu2.1 - ${project.version} + 3.5.0 true ca.uhn.hapi.fhir hapi-fhir-validation-resources-dstu2 - ${project.version} + 3.5.0 true ca.uhn.hapi.fhir hapi-fhir-structures-dstu3 - ${project.version} + 3.5.0 true ca.uhn.hapi.fhir hapi-fhir-validation-resources-dstu3 - ${project.version} + 3.5.0 true ca.uhn.hapi.fhir hapi-fhir-structures-r4 - ${project.version} + 3.5.0 true ca.uhn.hapi.fhir hapi-fhir-validation-resources-r4 - ${project.version} + 3.5.0 true @@ -118,13 +119,13 @@ ca.uhn.hapi.fhir hapi-fhir-server - ${project.version} + 3.5.0 test ca.uhn.hapi.fhir hapi-fhir-client - ${project.version} + 3.5.0 test diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/QuestionnaireResponseValidatorDstu3Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/QuestionnaireResponseValidatorDstu3Test.java index e5b67b9ce76..7aebc0d3b60 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/QuestionnaireResponseValidatorDstu3Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/QuestionnaireResponseValidatorDstu3Test.java @@ -309,9 +309,9 @@ public class QuestionnaireResponseValidatorDstu3Test { public void testRequiredQuestionWithEnableWhenHdesQuestionHasAnswerTrue() { Questionnaire q = new Questionnaire(); - q.addItem().setLinkId("link0").setRequired(false).setType(QuestionnaireItemType.STRING); + q.addItem().setLinkId("link0").setRequired(true).setType(QuestionnaireItemType.STRING); - //link1 question is enabled when link0 has answer + // create the questionnaire QuestionnaireItemComponent item1 = new QuestionnaireItemComponent(); item1.setLinkId("link1").setRequired(true); q.addItem(item1); @@ -320,9 +320,11 @@ public class QuestionnaireResponseValidatorDstu3Test { enable.setQuestion("link0"); enable.setHasAnswer(true); + QuestionnaireResponse qa = new QuestionnaireResponse(); qa.setStatus(QuestionnaireResponseStatus.COMPLETED); qa.getQuestionnaire().setReference("http://example.com/Questionnaire/q1"); + qa.addItem().setLinkId("link0").addAnswer().setValue(new StringType("FOO")); String reference = qa.getQuestionnaire().getReference(); when(myValSupport.fetchResource(any(FhirContext.class), eq(Questionnaire.class), eq(reference))).thenReturn(q); @@ -332,7 +334,35 @@ public class QuestionnaireResponseValidatorDstu3Test { assertThat(errors.toString(), containsString("No issues")); } + @Test + public void testRequiredQuestionWithEnableWhenHidesQuestion() { + Questionnaire q = new Questionnaire(); + q.addItem().setLinkId("link0").setRequired(false).setType(QuestionnaireItemType.STRING); + + // create the questionnaire + QuestionnaireItemComponent item1 = new QuestionnaireItemComponent(); + item1.setLinkId("link1").setRequired(true); + q.addItem(item1); + QuestionnaireItemEnableWhenComponent enable = new QuestionnaireItemEnableWhenComponent(); + item1.addEnableWhen(enable); + enable.setQuestion("link0"); + enable.setHasAnswer(true); + + + QuestionnaireResponse qa = new QuestionnaireResponse(); + qa.setStatus(QuestionnaireResponseStatus.COMPLETED); + qa.getQuestionnaire().setReference("http://example.com/Questionnaire/q1"); + //qa.addItem().setLinkId("link0").addAnswer().setValue(new StringType("FOO")); + + String reference = qa.getQuestionnaire().getReference(); + when(myValSupport.fetchResource(any(FhirContext.class), eq(Questionnaire.class), eq(reference))).thenReturn(q); + ValidationResult errors = myVal.validateWithResult(qa); + + ourLog.info(errors.toString()); + assertThat(errors.toString(), containsString("No issues")); + } + @Test public void testRequiredQuestionWithEnableWhenHasAnswerTrueWithAnswer() { @@ -364,10 +394,12 @@ public class QuestionnaireResponseValidatorDstu3Test { @Test - public void testRequiredQuestionWithEnableWhenHidesRequiredQuestionnHasAnswerFalse() { + public void testRequiredQuestionWithEnableWheHidesRequiredQuestionnHasAnswerFalse() { Questionnaire q = new Questionnaire(); q.addItem().setLinkId("link0").setRequired(false).setType(QuestionnaireItemType.STRING); + + // create the questionnaire QuestionnaireItemComponent item1 = new QuestionnaireItemComponent(); item1.setLinkId("link1").setRequired(true); q.addItem(item1);