performer validation implementation is now list based
added Test
This commit is contained in:
patrick-werner 2018-02-22 12:23:42 +01:00
parent 8cf92d6ffc
commit 0af95842a9
2 changed files with 20 additions and 1 deletions

View File

@ -3538,7 +3538,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
// all observations should have a subject, a performer, and a time
bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("subject") != null, "All observations should have a subject");
bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("performer") != null, "All observations should have a performer");
List<Element> performer = new ArrayList();
element.getNamedChildren("performer", performer);
bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), !performer.isEmpty(), "All observations should have a performer");
bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("effectiveDateTime") != null || element.getNamedChild("effectivePeriod") != null,
"All observations should have an effectiveDateTime or an effectivePeriod");
}

View File

@ -208,6 +208,23 @@ public class FhirInstanceValidatorR4Test {
}
/**
* See #853
*/
@Test
public void testObservationsWithMultiplePerformers() {
Observation observation = new Observation();
observation.setStatus(ObservationStatus.FINAL);
observation.setCode(new CodeableConcept().addCoding(new Coding().setSystem("http://system").setCode("code")));
Practitioner p1 = new Practitioner();
Practitioner p2 = new Practitioner();
observation.addPerformer(new Reference(p1));
observation.addPerformer(new Reference(p2));
ValidationResult output = myVal.validateWithResult(observation);
List<SingleValidationMessage> errors = logResultsAndReturnNonInformationalOnes(output);
assertThat(errors, empty());
}
@Test
public void testBase64Invalid() {