Skip to content

Commit

Permalink
MAINT-1947 Unit test for nested FHIR ValueSet
Browse files Browse the repository at this point in the history
  • Loading branch information
pgwilliams authored and dmcgihtsdo committed Jan 16, 2023
1 parent 080aa82 commit 127cb2a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,24 @@ void testExplicitValueSetExpansion() {
restTemplate.delete(baseUrl + "/reason-for-encounter");
}

@Test
void testExplicitNestedValueSetExpansion() {
ClassLoader classloader = Thread.currentThread().getContextClassLoader();
InputStream is = classloader.getResourceAsStream("dummy-fhir-content/exampleVS_incude_implicit_VS.json");
assertNotNull(is);
ValueSet exampleVS = fhirJsonParser.parseResource(ValueSet.class, is);
String vsJson = fhirJsonParser.encodeResourceToString(exampleVS);
storeVs("test-nested-vs", vsJson);

//Now expand that ValueSet we just saved
String url = baseUrl + "/test-nested-vs/$expand";
ResponseEntity<String> response = restTemplate.getForEntity(url, String.class);
ValueSet savedVS = fhirJsonParser.parseResource(ValueSet.class, response.getBody());

//10 Concepts on MAIN
assertEquals(10, savedVS.getExpansion().getTotal());
restTemplate.delete(baseUrl + "/test-nested-vs");
}
@Test
void testECLWithUnpublishedVersion() throws FHIROperationException {
//Asking for 5 at a time, expect 13 Total - 10 on MAIN + 3 in the sample module + 1 Root concept
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"resourceType": "ValueSet",
"status": "active",
"name": "Test nested VS",
"id": "test-nested-vs",
"title": "Test Nested VS",
"version": "0.0.1",
"url": "http://snomed.test/fhir/ValueSet/test-nested-vs",
"compose": {
"include": [
{
"valueSet": "http://snomed.info/sct?fhir_vs=ecl/<138875005"
}
]
}
}

0 comments on commit 127cb2a

Please sign in to comment.