Fix all tests in validation package

This commit is contained in:
Tadgh 2021-08-19 15:25:19 -04:00
parent 101e0d7288
commit b352bc5c96
2 changed files with 9 additions and 10 deletions

View File

@ -1312,13 +1312,13 @@ public class FhirInstanceValidatorDstu3Test {
String input = IOUtils.toString(FhirInstanceValidatorDstu3Test.class.getResourceAsStream("/dstu3-rick-test.json"), Charsets.UTF_8);
IResourceValidator.IValidatorResourceFetcher resourceFetcher = mock(IResourceValidator.IValidatorResourceFetcher.class);
when(resourceFetcher.validationPolicy(any(), anyString(), anyString(), anyString())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS);
when(resourceFetcher.validationPolicy(any(), any(), any(), any())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS);
myInstanceVal.setValidatorResourceFetcher(resourceFetcher);
myVal.validateWithResult(input);
verify(resourceFetcher, times(3)).resolveURL(any(), anyString(), anyString(), anyString(), anyString());
verify(resourceFetcher, times(4)).validationPolicy(any(), anyString(), anyString(), anyString());
verify(resourceFetcher, times(4)).fetch(any(), anyString(), anyString());
verify(resourceFetcher, times(3)).resolveURL(any(), any(), anyString(), anyString(), anyString());
verify(resourceFetcher, times(4)).validationPolicy(any(), any(), anyString(), anyString());
verify(resourceFetcher, times(4)).fetch(any(), any(), anyString());
}
@Test

View File

@ -995,8 +995,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
List<SingleValidationMessage> messages = logResultsAndReturnNonInformationalOnes(output);
assertEquals(3, messages.size(), output.toString());
assertThat(messages.get(0).getMessage(), containsString("Element must have some content"));
assertThat(messages.get(1).getMessage(), containsString("Primitive types must have a value or must have child extensions"));
assertThat(messages.get(2).getMessage(), containsString("ele-1: 'All FHIR elements must have a @value or children' Rule 'All FHIR elements must have a @value or children' Failed"));
assertThat(messages.get(2).getMessage(), containsString("Primitive types must have a value or must have child extensions"));
}
@Test
@ -1398,13 +1397,13 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
String encoded = loadResource("/r4/r4-caredove-bundle.json");
IResourceValidator.IValidatorResourceFetcher resourceFetcher = mock(IResourceValidator.IValidatorResourceFetcher.class);
when(resourceFetcher.validationPolicy(any(), anyString(), anyString(), anyString())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS);
when(resourceFetcher.validationPolicy(any(), any(), any(), any())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS);
myInstanceVal.setValidatorResourceFetcher(resourceFetcher);
myVal.validateWithResult(encoded);
verify(resourceFetcher, times(15)).resolveURL(any(), anyString(), anyString(), anyString(), anyString());
verify(resourceFetcher, times(12)).validationPolicy(any(), anyString(), anyString(), anyString());
verify(resourceFetcher, times(12)).fetch(any(), anyString(), anyString());
verify(resourceFetcher, times(15)).resolveURL(any(), any(), anyString(), anyString(), anyString());
verify(resourceFetcher, times(12)).validationPolicy(any(), any(), anyString(), anyString());
verify(resourceFetcher, times(12)).fetch(any(), any(), anyString());
}
@Test