WIP Fix FhirInstanceValidatorDstu3Test
This commit is contained in:
parent
2a5792e44d
commit
0f84ccd14c
|
@ -817,7 +817,7 @@ public class FhirInstanceValidatorDstu3Test {
|
|||
Patient resource = loadResource("/dstu3/nl/nl-core-patient-01.json", Patient.class);
|
||||
ValidationResult results = myVal.validateWithResult(resource);
|
||||
List<SingleValidationMessage> outcome = logResultsAndReturnNonInformationalOnes(results);
|
||||
assertThat(outcome.toString(), containsString("The Coding provided (urn:oid:2.16.840.1.113883.2.4.4.16.34#6030) is not in the value set 'LandGBACodelijst'"));
|
||||
assertThat(outcome.toString(), containsString("The Coding provided (urn:oid:2.16.840.1.113883.2.4.4.16.34#6030) was not found in the value set 'LandGBACodelijst'"));
|
||||
}
|
||||
|
||||
private void loadNL() throws IOException {
|
||||
|
@ -982,7 +982,7 @@ public class FhirInstanceValidatorDstu3Test {
|
|||
ValidationResult output = myVal.validateWithResult(encoded);
|
||||
assertEquals(1, output.getMessages().size(), output.toString());
|
||||
|
||||
assertEquals("The extension http://hl7.org/fhir/v3/ethnicity is unknown, and not allowed here", output.getMessages().get(0).getMessage());
|
||||
assertEquals("The extension http://hl7.org/fhir/v3/ethnicity could not be found so is not allowed here", output.getMessages().get(0).getMessage());
|
||||
assertEquals(ResultSeverityEnum.ERROR, output.getMessages().get(0).getSeverity());
|
||||
}
|
||||
|
||||
|
@ -1050,7 +1050,7 @@ public class FhirInstanceValidatorDstu3Test {
|
|||
ValidationResult output = myVal.validateWithResult(input);
|
||||
List<SingleValidationMessage> res = logResultsAndReturnNonInformationalOnes(output);
|
||||
assertEquals(1, res.size(), output.toString());
|
||||
assertEquals("A code with no system has no defined meaning. A system should be provided", output.getMessages().get(0).getMessage());
|
||||
assertEquals("A code with no system has no defined meaning, and it cannot be validated. A system should be provided", output.getMessages().get(0).getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1167,7 +1167,7 @@ public class FhirInstanceValidatorDstu3Test {
|
|||
public void testValidateResourceContainingProfileDeclarationDoesntResolve() {
|
||||
addValidConcept("http://loinc.org", "12345");
|
||||
|
||||
Observation input = new Observation();
|
||||
Observation input = createObservationWithDefaultSubjectPerfomerEffective();
|
||||
input.getMeta().addProfile("http://foo/structuredefinition/myprofile");
|
||||
|
||||
input.getCode().addCoding().setSystem("http://loinc.org").setCode("12345");
|
||||
|
@ -1176,7 +1176,7 @@ public class FhirInstanceValidatorDstu3Test {
|
|||
myInstanceVal.setValidationSupport(myValidationSupport);
|
||||
ValidationResult output = myVal.validateWithResult(input);
|
||||
List<SingleValidationMessage> errors = logResultsAndReturnNonInformationalOnes(output);
|
||||
assertThat(errors.toString(), containsString("Profile reference 'http://foo/structuredefinition/myprofile' has not been checked because it is unknown"));
|
||||
assertThat(errors.toString(), containsString("Profile reference 'http://foo/structuredefinition/myprofile' has not been checked because it could not be found"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -1193,9 +1193,17 @@ public class FhirInstanceValidatorDstu3Test {
|
|||
|
||||
}
|
||||
|
||||
private Observation createObservationWithDefaultSubjectPerfomerEffective() {
|
||||
Observation observation = new Observation();
|
||||
observation.setSubject(new Reference("Patient/123"));
|
||||
observation.addPerformer(new Reference("Practitioner/124"));
|
||||
observation.setEffective(new DateTimeType("2023-01-01T11:22:33Z"));
|
||||
return observation;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidateResourceWithDefaultValueset() {
|
||||
Observation input = new Observation();
|
||||
Observation input = createObservationWithDefaultSubjectPerfomerEffective();
|
||||
|
||||
input.setStatus(ObservationStatus.FINAL);
|
||||
input.getCode().setText("No code here!");
|
||||
|
@ -1221,13 +1229,13 @@ public class FhirInstanceValidatorDstu3Test {
|
|||
logResultsAndReturnAll(output);
|
||||
assertThat(
|
||||
output.getMessages().get(0).getMessage(),
|
||||
containsString("The value provided ('notvalidcode') is not in the value set 'ObservationStatus'")
|
||||
containsString("The value provided ('notvalidcode') was not found in the value set 'ObservationStatus'")
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidateResourceWithExampleBindingCodeValidationFailing() {
|
||||
Observation input = new Observation();
|
||||
Observation input = createObservationWithDefaultSubjectPerfomerEffective();
|
||||
|
||||
myInstanceVal.setValidationSupport(myValidationSupport);
|
||||
|
||||
|
@ -1259,7 +1267,7 @@ public class FhirInstanceValidatorDstu3Test {
|
|||
|
||||
@Test
|
||||
public void testValidateResourceWithExampleBindingCodeValidationPassingLoinc() {
|
||||
Observation input = new Observation();
|
||||
Observation input = createObservationWithDefaultSubjectPerfomerEffective();
|
||||
|
||||
myInstanceVal.setValidationSupport(myValidationSupport);
|
||||
addValidConcept("http://loinc.org", "12345");
|
||||
|
@ -1274,7 +1282,7 @@ public class FhirInstanceValidatorDstu3Test {
|
|||
|
||||
@Test
|
||||
public void testValidateResourceWithExampleBindingCodeValidationPassingLoincWithExpansion() {
|
||||
Observation input = new Observation();
|
||||
Observation input = createObservationWithDefaultSubjectPerfomerEffective();
|
||||
|
||||
ValueSetExpansionComponent expansionComponent = new ValueSetExpansionComponent();
|
||||
expansionComponent.addContains().setSystem("http://loinc.org").setCode("12345").setDisplay("Some display code");
|
||||
|
@ -1294,7 +1302,7 @@ public class FhirInstanceValidatorDstu3Test {
|
|||
|
||||
@Test
|
||||
public void testValidateResourceWithExampleBindingCodeValidationPassingNonLoinc() {
|
||||
Observation input = new Observation();
|
||||
Observation input = createObservationWithDefaultSubjectPerfomerEffective();
|
||||
|
||||
myInstanceVal.setValidationSupport(myValidationSupport);
|
||||
addValidConcept("http://acme.org", "12345");
|
||||
|
|
Loading…
Reference in New Issue