Add ignored test for #1740
This commit is contained in:
parent
4d7f39cfdc
commit
13fbdf418f
|
@ -66,10 +66,13 @@ import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
import static org.junit.Assert.assertTrue;
|
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.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.times;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
public class FhirInstanceValidatorR4Test extends BaseTest {
|
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());
|
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
|
* See #1676 - We should ignore schema location
|
||||||
*/
|
*/
|
||||||
|
@ -400,7 +430,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
|
||||||
List<SingleValidationMessage> errors = logResultsAndReturnNonInformationalOnes(output);
|
List<SingleValidationMessage> errors = logResultsAndReturnNonInformationalOnes(output);
|
||||||
errors = errors
|
errors = errors
|
||||||
.stream()
|
.stream()
|
||||||
.filter(t->t.getMessage().contains("Bundle entry missing fullUrl"))
|
.filter(t -> t.getMessage().contains("Bundle entry missing fullUrl"))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
assertEquals(5, errors.size());
|
assertEquals(5, errors.size());
|
||||||
}
|
}
|
||||||
|
@ -658,7 +688,6 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
|
||||||
.setCode("acd");
|
.setCode("acd");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Should pass
|
// Should pass
|
||||||
ValidationResult output = val.validateWithResult(input);
|
ValidationResult output = val.validateWithResult(input);
|
||||||
List<SingleValidationMessage> all = logResultsAndReturnErrorOnes(output);
|
List<SingleValidationMessage> all = logResultsAndReturnErrorOnes(output);
|
||||||
|
@ -1094,7 +1123,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
|
||||||
@Ignore
|
@Ignore
|
||||||
public void testValidateDecimalWithTrailingDot() {
|
public void testValidateDecimalWithTrailingDot() {
|
||||||
String input = "{" +
|
String input = "{" +
|
||||||
" \"resourceType\": \"Observation\"," +
|
" \"resourceType\": \"Observation\"," +
|
||||||
" \"status\": \"final\"," +
|
" \"status\": \"final\"," +
|
||||||
" \"subject\": {\"reference\":\"Patient/123\"}," +
|
" \"subject\": {\"reference\":\"Patient/123\"}," +
|
||||||
" \"code\": { \"coding\": [{ \"system\":\"http://foo\", \"code\":\"123\" }] }," +
|
" \"code\": { \"coding\": [{ \"system\":\"http://foo\", \"code\":\"123\" }] }," +
|
||||||
|
@ -1110,8 +1139,8 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
|
||||||
" },\n" +
|
" },\n" +
|
||||||
" \"text\": \"210.0-925.\"\n" +
|
" \"text\": \"210.0-925.\"\n" +
|
||||||
" }\n" +
|
" }\n" +
|
||||||
" ]"+
|
" ]" +
|
||||||
"}";
|
"}";
|
||||||
ourLog.info(input);
|
ourLog.info(input);
|
||||||
ValidationResult output = myVal.validateWithResult(input);
|
ValidationResult output = myVal.validateWithResult(input);
|
||||||
logResultsAndReturnAll(output);
|
logResultsAndReturnAll(output);
|
||||||
|
@ -1263,7 +1292,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
|
||||||
String encoded = loadResource("/r4/r4-caredove-bundle.json");
|
String encoded = loadResource("/r4/r4-caredove-bundle.json");
|
||||||
|
|
||||||
IResourceValidator.IValidatorResourceFetcher resourceFetcher = mock(IResourceValidator.IValidatorResourceFetcher.class);
|
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);
|
myInstanceVal.setValidatorResourceFetcher(resourceFetcher);
|
||||||
myVal.validateWithResult(encoded);
|
myVal.validateWithResult(encoded);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue