Add test for #938

This commit is contained in:
James Agnew 2018-05-13 09:03:12 -04:00
parent 7ac0dd2ee5
commit 8c47d966e9
1 changed files with 19 additions and 0 deletions

View File

@ -194,6 +194,25 @@ public class FhirInstanceValidatorR4Test {
return retVal;
}
/**
* See #938
*/
@Test
public void testValidateEmptyElement() {
String input = "<Patient xmlns=\"http://hl7.org/fhir\">" +
"<active value=\"\"/>" +
"</Patient>";
FhirValidator val = ourCtx.newValidator();
val.registerValidatorModule(new FhirInstanceValidator(myDefaultValidationSupport));
ValidationResult result = val.validateWithResult(input);
List<SingleValidationMessage> all = logResultsAndReturnAll(result);
assertFalse(result.isSuccessful());
assertEquals("primitive types must have a value or must have child extensions", all.get(0).getMessage());
}
private List<SingleValidationMessage> logResultsAndReturnNonInformationalOnes(ValidationResult theOutput) {
List<SingleValidationMessage> retVal = new ArrayList<SingleValidationMessage>();