From 4cab7f8b8078a9a2e536fe7da420b8ceeef4600a Mon Sep 17 00:00:00 2001 From: Jaison B Date: Mon, 8 Nov 2021 11:26:13 -0700 Subject: [PATCH] Add test to check bundle entry path being added to validation messages --- .../hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java | 3 +++ 1 file changed, 3 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 28090b66939..bd70c912583 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 @@ -1524,6 +1524,9 @@ public class FhirInstanceValidatorR4Test extends BaseTest { StopWatch stopwatch = new StopWatch(); ValidationResult output = myFhirValidator.validateWithResult(bundle); ourLog.info("Validation time: {}", stopwatch); + // assert that validation messages include the bundle entry path + assertTrue(output.getMessages().stream().anyMatch(message -> message.getLocationString().contains("Bundle.entry[0].resource.ofType(Patient)"))); + assertTrue(output.getMessages().stream().anyMatch(message -> message.getLocationString().contains("Bundle.entry[1].resource.ofType(Patient)"))); // validate List all = logResultsAndReturnErrorOnes(output); assertThat(output.getMessages(), hasSize(entriesCount * 2));