Do not force enableWhen to have system
This commit is contained in:
parent
dd8e027ff4
commit
58959eec48
|
@ -11,7 +11,7 @@
|
|||
|
||||
<artifactId>hapi-fhir-validation</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
<version>3.6.3-PHRFIX</version>
|
||||
<version>3.6.4-PHRFIX</version>
|
||||
|
||||
<name>HAPI FHIR - Validation</name>
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ public class DefaultEnableWhenEvaluator implements IEnableWhenEvaluator {
|
|||
}
|
||||
|
||||
private boolean compareSystems(Coding expectedCoding, Coding value) {
|
||||
if (expectedCoding.hasSystem() != value.hasSystem()) {
|
||||
if (expectedCoding.hasSystem() && !value.hasSystem()) {
|
||||
return false;
|
||||
}
|
||||
if (expectedCoding.hasSystem()) {
|
||||
|
|
|
@ -586,6 +586,35 @@ public class QuestionnaireResponseValidatorDstu3Test {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChoiceItemsEnableWhenHasNoSystemYetAnswerHasSystem() throws Exception {
|
||||
Questionnaire q = new Questionnaire();
|
||||
Coding qcoding = new Coding();
|
||||
qcoding.setCode("male");
|
||||
qcoding.setSystem("http://hl7.org/fhir/administrative-gender");
|
||||
q.addItem().setLinkId("1B").setRequired(true).setType(CHOICE).addOption().setValue(qcoding);
|
||||
Coding enablewhenCoding = new Coding();
|
||||
enablewhenCoding.setCode("male");
|
||||
q.addItem().setLinkId("2B").setType(BOOLEAN).addEnableWhen().setQuestion("1B").setAnswer(enablewhenCoding);
|
||||
|
||||
QuestionnaireResponse qr = new QuestionnaireResponse();
|
||||
qr.setStatus(COMPLETED);
|
||||
qr.getQuestionnaire().setReference(QUESTIONNAIRE_URL);
|
||||
QuestionnaireResponseItemComponent qrItem = qr.addItem().setLinkId("1B");
|
||||
Coding coding = new Coding();
|
||||
coding.setCode("male");
|
||||
coding.setSystem("http://hl7.org/fhir/administrative-gender");
|
||||
QuestionnaireResponseItemAnswerComponent answer = qrItem.addAnswer();
|
||||
answer.setValue(coding);
|
||||
qr.addItem().setLinkId("2B").addAnswer().setValue(new BooleanType(true));
|
||||
|
||||
String reference = qr.getQuestionnaire().getReference();
|
||||
when(myValSupport.fetchResource(any(FhirContext.class), eq(Questionnaire.class), eq(reference))).thenReturn(q);
|
||||
|
||||
ValidationResult errors = myVal.validateWithResult(qr);
|
||||
assertThat(errors.toString(), containsString("No issues"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmbeddedItemInChoice() {
|
||||
String questionnaireRef = QUESTIONNAIRE_URL;
|
||||
|
|
Loading…
Reference in New Issue