Add test to check bundle entry path being added to validation messages

This commit is contained in:
Jaison B 2021-11-08 11:26:13 -07:00
parent b5d6fb4aeb
commit 4cab7f8b80
1 changed files with 3 additions and 0 deletions

View File

@ -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<SingleValidationMessage> all = logResultsAndReturnErrorOnes(output);
assertThat(output.getMessages(), hasSize(entriesCount * 2));