Fix FhirInstanceValidatorR4Test

This commit is contained in:
dotasek 2023-12-15 11:35:38 -05:00
parent 3c7ed51c3e
commit fc0faa7676
4 changed files with 19 additions and 8 deletions

View File

@ -162,7 +162,10 @@ public final class HapiWorkerContext extends I18nBase implements IWorkerContext
@Override
public boolean supportsSystem(String system, FhirPublication fhirVersion) throws TerminologyServiceException {
throw new UnsupportedOperationException(Msg.code(2461));
if (!fhirVersion.equals(FhirPublication.R5)) {
throw new UnsupportedOperationException(Msg.code(2461));
}
return supportsSystem(system);
}
@Override

View File

@ -624,7 +624,7 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo
@Override
public boolean supportsSystem(String system, FhirPublication fhirVersion) throws TerminologyServiceException {
return false;
return supportsSystem(system);
}
@Override

View File

@ -1419,7 +1419,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
@Test
public void testValidateResourceWithExampleBindingCodeValidationPassingLoincWithExpansion() {
Observation input = new Observation();
Observation input = createObservationWithDefaultSubjectPerfomerEffective();
input.getText().setDiv(new XhtmlNode().setValue("<div>AA</div>")).setStatus(Narrative.NarrativeStatus.GENERATED);
ValueSetExpansionComponent expansionComponent = new ValueSetExpansionComponent();
@ -1440,7 +1440,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
@Test
public void testValidateResourceWithExampleBindingCodeValidationPassingNonLoinc() {
Observation input = new Observation();
Observation input = createObservationWithDefaultSubjectPerfomerEffective();
input.getText().setDiv(new XhtmlNode().setValue("<div>AA</div>")).setStatus(Narrative.NarrativeStatus.GENERATED);
myInstanceVal.setValidationSupport(myValidationSupport);
@ -1486,7 +1486,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
all = logResultsAndReturnNonInformationalOnes(output);
assertEquals(2, all.size());
assertThat(all.get(0).getMessage(), containsString("The unit 'Heck' is unknown' at position 0 for 'http://unitsofmeasure.org#Heck'"));
assertThat(all.get(1).getMessage(), containsString("The value provided ('Heck') is not in the value set 'Body Temperature Units'"));
assertThat(all.get(1).getMessage(), containsString("The value provided ('Heck') was not found in the value set 'Body Temperature Units'"));
}
@ -1748,12 +1748,12 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
assertEquals("Unknown code 'urn:iso:std:iso:4217#blah' for 'urn:iso:std:iso:4217#blah'", result.getMessages().get(0).getMessage());
assertEquals(ResultSeverityEnum.ERROR, result.getMessages().get(0).getSeverity());
assertEquals(15, result.getMessages().get(0).getLocationLine());
assertEquals(22, result.getMessages().get(0).getLocationLine());
assertEquals(4, result.getMessages().get(0).getLocationCol());
assertEquals("Observation.value.ofType(Quantity)", result.getMessages().get(0).getLocationString());
assertEquals("Terminology_PassThrough_TX_Message", result.getMessages().get(0).getMessageId());
assertEquals(15, ((IntegerType) oo.getIssue().get(0).getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-line").getValue()).getValue());
assertEquals(22, ((IntegerType) oo.getIssue().get(0).getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-line").getValue()).getValue());
assertEquals(4, ((IntegerType) oo.getIssue().get(0).getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-col").getValue()).getValue());
assertEquals("Terminology_PassThrough_TX_Message", ((StringType) oo.getIssue().get(0).getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/operationoutcome-message-id").getValue()).getValue());
assertEquals("Unknown code 'urn:iso:std:iso:4217#blah' for 'urn:iso:std:iso:4217#blah'", oo.getIssue().get(0).getDiagnostics());
@ -1761,7 +1761,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
assertEquals(OperationOutcome.IssueSeverity.ERROR, oo.getIssue().get(0).getSeverity());
assertEquals(2, oo.getIssue().get(0).getLocation().size());
assertEquals("Observation.value.ofType(Quantity)", oo.getIssue().get(0).getLocation().get(0).getValue());
assertEquals("Line[15] Col[4]", oo.getIssue().get(0).getLocation().get(1).getValue());
assertEquals("Line[22] Col[4]", oo.getIssue().get(0).getLocation().get(1).getValue());
}

View File

@ -6,6 +6,10 @@
"http://hl7.org/fhir/StructureDefinition/bodytemp"
]
},
"text": {
"status" : "generated",
"div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\">Dummy text</div>"
},
"status": "final",
"category": [
{
@ -28,6 +32,10 @@
"subject": {
"reference": "Patient/1"
},
"performer" : [{
"reference" : "Practitioner/2",
"display" : "A. Langeveld"
}],
"effectiveDateTime": "2020-04-30T12:00:00+01:00",
"valueQuantity": {
"value": 37.5,