Add ignored test for #1740

This commit is contained in:
jamesagnew 2020-03-03 05:21:43 -05:00
parent 4d7f39cfdc
commit 13fbdf418f
1 changed files with 37 additions and 8 deletions

View File

@ -66,10 +66,13 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.*;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
public class FhirInstanceValidatorR4Test extends BaseTest {
@ -280,6 +283,33 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
assertEquals("Primitive types must have a value that is not empty", all.get(0).getMessage());
}
/**
* See #1740
*/
@Ignore
@Test
public void testValidateScalarInRepeatableField() {
String operationDefinition = "{\n" +
" \"resourceType\": \"OperationDefinition\",\n" +
" \"name\": \"Questionnaire\",\n" +
" \"status\": \"draft\",\n" +
" \"kind\" : \"operation\",\n" +
" \"code\": \"populate\",\n" +
" \"resource\": \"Patient\",\n" + // should be array
" \"system\": false,\n" + " " +
" \"type\": false,\n" +
" \"instance\": true\n" +
"}";
FhirValidator val = ourCtx.newValidator();
val.registerValidatorModule(new FhirInstanceValidator(myDefaultValidationSupport));
ValidationResult result = val.validateWithResult(operationDefinition);
List<SingleValidationMessage> all = logResultsAndReturnAll(result);
assertFalse(result.isSuccessful());
assertEquals("Primitive types must have a value that is not empty", all.get(0).getMessage());
}
/**
* See #1676 - We should ignore schema location
*/
@ -400,7 +430,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
List<SingleValidationMessage> errors = logResultsAndReturnNonInformationalOnes(output);
errors = errors
.stream()
.filter(t->t.getMessage().contains("Bundle entry missing fullUrl"))
.filter(t -> t.getMessage().contains("Bundle entry missing fullUrl"))
.collect(Collectors.toList());
assertEquals(5, errors.size());
}
@ -658,7 +688,6 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
.setCode("acd");
// Should pass
ValidationResult output = val.validateWithResult(input);
List<SingleValidationMessage> all = logResultsAndReturnErrorOnes(output);
@ -1094,7 +1123,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
@Ignore
public void testValidateDecimalWithTrailingDot() {
String input = "{" +
" \"resourceType\": \"Observation\"," +
" \"resourceType\": \"Observation\"," +
" \"status\": \"final\"," +
" \"subject\": {\"reference\":\"Patient/123\"}," +
" \"code\": { \"coding\": [{ \"system\":\"http://foo\", \"code\":\"123\" }] }," +
@ -1110,8 +1139,8 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
" },\n" +
" \"text\": \"210.0-925.\"\n" +
" }\n" +
" ]"+
"}";
" ]" +
"}";
ourLog.info(input);
ValidationResult output = myVal.validateWithResult(input);
logResultsAndReturnAll(output);
@ -1263,7 +1292,7 @@ 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())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS);
when(resourceFetcher.validationPolicy(any(), anyString(), anyString())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS);
myInstanceVal.setValidatorResourceFetcher(resourceFetcher);
myVal.validateWithResult(encoded);