From 8c47d966e9f4f0269cf88e3629129ba72e96a085 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Sun, 13 May 2018 09:03:12 -0400 Subject: [PATCH] Add test for #938 --- .../FhirInstanceValidatorR4Test.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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..4d238bf8c71 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 @@ -194,6 +194,25 @@ public class FhirInstanceValidatorR4Test { return retVal; } + /** + * See #938 + */ + @Test + public void testValidateEmptyElement() { + String input = "" + + "" + + ""; + + FhirValidator val = ourCtx.newValidator(); + val.registerValidatorModule(new FhirInstanceValidator(myDefaultValidationSupport)); + + ValidationResult result = val.validateWithResult(input); + List all = logResultsAndReturnAll(result); + assertFalse(result.isSuccessful()); + assertEquals("primitive types must have a value or must have child extensions", all.get(0).getMessage()); + } + + private List logResultsAndReturnNonInformationalOnes(ValidationResult theOutput) { List retVal = new ArrayList();