Added test case for CodeSystem.supplements with versioned canonical
This commit is contained in:
parent
81f02da5c2
commit
962aee14a3
|
@ -1,5 +1,9 @@
|
||||||
package org.hl7.fhir.validation;
|
package org.hl7.fhir.validation;
|
||||||
|
|
||||||
|
import static org.hamcrest.Matchers.is;
|
||||||
|
import static org.hamcrest.Matchers.empty;
|
||||||
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -25,7 +29,7 @@ public class ResourceValidationTests {
|
||||||
private static InstanceValidator val;
|
private static InstanceValidator val;
|
||||||
|
|
||||||
|
|
||||||
private void runTest(String filename) throws IOException, FileNotFoundException, Exception {
|
private List<ValidationMessage> runTest(String filename) throws IOException, FileNotFoundException, Exception {
|
||||||
TestingUtilities.injectCorePackageLoader();
|
TestingUtilities.injectCorePackageLoader();
|
||||||
if (val == null) {
|
if (val == null) {
|
||||||
ctxt = TestingUtilities.getSharedWorkerContext();
|
ctxt = TestingUtilities.getSharedWorkerContext();
|
||||||
|
@ -37,6 +41,7 @@ public class ResourceValidationTests {
|
||||||
Resource res = (Resource) new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", filename));
|
Resource res = (Resource) new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", filename));
|
||||||
val.validate(val, errors, res);
|
val.validate(val, errors, res);
|
||||||
Assertions.assertNotNull(errors);
|
Assertions.assertNotNull(errors);
|
||||||
|
return errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,4 +128,26 @@ public class ResourceValidationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCodesystemSupplementsVersion() throws Exception {
|
||||||
|
List<ValidationMessage> errors = runTest("codesystem-example-supplement-version.xml");
|
||||||
|
assertNoErrors(errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void assertNoErrors(List<ValidationMessage> errors) {
|
||||||
|
List<String> errorMessages = new ArrayList<>();
|
||||||
|
for(ValidationMessage message : errors) {
|
||||||
|
// we will skip the message that WG citation is needed
|
||||||
|
if("VALIDATION_HL7_WG_NEEDED".equals(message.getMessageId())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(message.getLevel().isError()) {
|
||||||
|
errorMessages.add(message.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assertThat("No error message expected in validation outcome.", errorMessages, is(empty()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
2
pom.xml
2
pom.xml
|
@ -21,7 +21,7 @@
|
||||||
<commons_compress_version>1.26.0</commons_compress_version>
|
<commons_compress_version>1.26.0</commons_compress_version>
|
||||||
<guava_version>32.0.1-jre</guava_version>
|
<guava_version>32.0.1-jre</guava_version>
|
||||||
<hapi_fhir_version>6.4.1</hapi_fhir_version>
|
<hapi_fhir_version>6.4.1</hapi_fhir_version>
|
||||||
<validator_test_case_version>1.5.6</validator_test_case_version>
|
<validator_test_case_version>1.5.7-SNAPSHOT</validator_test_case_version>
|
||||||
<jackson_version>2.17.0</jackson_version>
|
<jackson_version>2.17.0</jackson_version>
|
||||||
<junit_jupiter_version>5.9.2</junit_jupiter_version>
|
<junit_jupiter_version>5.9.2</junit_jupiter_version>
|
||||||
<junit_platform_launcher_version>1.8.2</junit_platform_launcher_version>
|
<junit_platform_launcher_version>1.8.2</junit_platform_launcher_version>
|
||||||
|
|
Loading…
Reference in New Issue