Add test for invalid local reference (R4)

Currently an invalid local reference causes an InternalErrorException
caused by: FHIRException: Resource resolution services not provided.
The validation should instead return normally and contain an error
message.
This commit is contained in:
Heinz-Dieter Conradi 2018-03-01 10:28:32 +01:00 committed by Heinz-Dieter Conradi
parent 229e0977d2
commit f2cd05fe3b
1 changed files with 15 additions and 0 deletions

View File

@ -68,6 +68,21 @@ public class FhirInstanceValidatorR4Test {
myValidConcepts.add(theSystem + "___" + theCode);
}
/**
* An invalid local reference should not cause a ServiceException.
*/
@Test
public void testInvalidLocalReference() {
QuestionnaireResponse resource = new QuestionnaireResponse();
resource.setStatus(QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED);
resource.setSubject(new Reference("#invalid-ref"));
ValidationResult output = myVal.validateWithResult(resource);
List<SingleValidationMessage> nonInfo = logResultsAndReturnNonInformationalOnes(output);
assertThat(nonInfo, hasSize(2));
}
@SuppressWarnings("unchecked")
@Before
public void before() {