Add test for #739

This commit is contained in:
James Agnew 2017-09-27 21:36:40 -04:00
parent 87383ad802
commit 328080e87b
2 changed files with 58 additions and 0 deletions

View File

@ -336,6 +336,19 @@ public class FhirInstanceValidatorDstu3Test {
assertTrue(output.isSuccessful());
}
/**
* See #739
*/
@Test
public void testValidateMedicationIngredient() throws IOException {
String input = IOUtils.toString(FhirInstanceValidatorDstu3Test.class.getResourceAsStream("/dstu3/bug739.json"), Charsets.UTF_8);
ValidationResult results = myVal.validateWithResult(input);
List<SingleValidationMessage> outcome = logResultsAndReturnNonInformationalOnes(results);
assertThat(outcome.toString(), containsString("Element 'Medication.ingredient.item[x]': minimum required = 1"));
}
@Test
public void testValidateQuestionnaireResponse() throws IOException {
String input = IOUtils.toString(FhirInstanceValidatorDstu3Test.class.getResourceAsStream("/qr_jon.xml"));

View File

@ -0,0 +1,45 @@
{
"resourceType": "Medication",
"code": {
"coding": [
{
"system": "urn:2.16.840.1.113883.6.88",
"code": "1191",
"display": "aspirin"
}
],
"text": "ASPIRIN 325 MG TABLET"
},
"form": {
"coding": [
{
"system": "http://upmc.com/enterprises/rakia/rakida/cerner/h1/medication/form/code",
"code": "687545",
"display": "Tab"
}
],
"text": "Tab"
},
"ingredient": [
{
"item": {
"reference": "medication/613168",
"display": "aspirin"
},
"amount": {
"numerator": {
"value": "650",
"unit": "mg",
"system": "http://upmc.com/enterprises/rakia/rakida/cerner/h1/medication/strength/unit",
"code": "MG"
},
"denominator": {
"value": "2",
"unit": "tab(s)",
"system": "http://upmc.com/enterprises/rakia/rakida/cerner/h1/medication/volume/unit",
"code": "TAB"
}
}
}
]
}