Cherry picked changes from master to 3.5.0 branch

This commit is contained in:
Eeva Turkka 2018-11-02 09:17:35 +02:00
parent 3082d5f2db
commit 7097526f81
3 changed files with 51 additions and 17 deletions

View File

@ -11,6 +11,7 @@
<artifactId>hapi-fhir-converter</artifactId>
<packaging>bundle</packaging>
<version>3.5.1-PHRFIX-SNAPSHOT</version>
<dependencies>
<dependency>
@ -84,7 +85,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-client</artifactId>
<version>${project.version}</version>
<version>3.5.0</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -11,6 +11,7 @@
<artifactId>hapi-fhir-validation</artifactId>
<packaging>bundle</packaging>
<version>3.5.1-PHRFIX-SNAPSHOT</version>
<name>HAPI FHIR - Validation</name>
@ -18,17 +19,17 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>${project.version}</version>
<version>3.5.0</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-utilities</artifactId>
<version>${project.version}</version>
<version>3.5.0</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-converter</artifactId>
<version>${project.version}</version>
<version>3.5.1-PHRFIX-SNAPSHOT</version>
</dependency>
<dependency>
@ -63,49 +64,49 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>${project.version}</version>
<version>3.5.0</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
<version>${project.version}</version>
<version>3.5.0</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2.1</artifactId>
<version>${project.version}</version>
<version>3.5.0</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
<version>${project.version}</version>
<version>3.5.0</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu3</artifactId>
<version>${project.version}</version>
<version>3.5.0</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
<version>${project.version}</version>
<version>3.5.0</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r4</artifactId>
<version>${project.version}</version>
<version>3.5.0</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-r4</artifactId>
<version>${project.version}</version>
<version>3.5.0</version>
<optional>true</optional>
</dependency>
@ -118,13 +119,13 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-server</artifactId>
<version>${project.version}</version>
<version>3.5.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-client</artifactId>
<version>${project.version}</version>
<version>3.5.0</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -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);