diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java index 7ff399c53af..5e593b68bb1 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java @@ -68,6 +68,21 @@ public class FhirInstanceValidatorR4Test { myValidConcepts.add(theSystem + "___" + theCode); } + /** + * An invalid local reference should not cause a ServiceException. + */ + @Test + public void testInvalidLocalReference() { + QuestionnaireResponse resource = new QuestionnaireResponse(); + resource.setStatus(QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED); + + resource.setSubject(new Reference("#invalid-ref")); + + ValidationResult output = myVal.validateWithResult(resource); + List nonInfo = logResultsAndReturnNonInformationalOnes(output); + assertThat(nonInfo, hasSize(2)); + } + @SuppressWarnings("unchecked") @Before public void before() {